Need a quick help

Hey! im trynna make a python script so when i hold my mouse side buttons and scroll up/down , it will left click and right click , the point of what im doing is just to have a high cps , but only when i hold mouse4/5 button , mouse 5 for left click and mouse 4 for right click , heres what i tried coding ( i suck at coding )

from pynput import mouse, keyboard

def on_scroll(x, y, dx, dy):
    if button5.is_pressed:
        return False

    if button4.is_pressed:
        return False

def on_press(key):
    if key == keyboard.Key.f5:
        return False

button4 = mouse.Button.button4
button5 = mouse.Button.button5

with mouse.Listener(on_scroll=on_scroll) as listener, keyboard.Listener(on_press=on_press) as k_listener:

and it gives me this error

Traceback (most recent call last):
  File "D:\Selfbot\root\", line 16, in <module>
    button4 = mouse.Button.button4
  File "C:\Users\imajo\AppData\Local\Programs\Python\Python310\lib\", line 437, in __getattr__
    raise AttributeError(name) from None
AttributeError: button4

can someone please help me achieve what im trying to make, or maybe if theres any software that can do what im trying to do?

It looks like pynput only knows about the left, right and middle buttons on a mouse. There isn’t any support for button4