USB debugging auto accept not working

Unable to implement the auto accept of usb debugging mode in python by following desired capabilities:

desired_caps[‘platformName’] = ‘Android’
desired_caps[‘platformVersion’] = ‘6.0.1’

desired_caps[‘automationName’] = ‘uiautomator2’

desired_caps[‘deviceName’] = ‘Galaxy On7 Pro’

desired_caps[‘udis’]= ‘4200ba31d4809300’

desired_caps[‘appPackage’] = ‘com.android.contacts’
desired_caps[‘appActivity’] = 'com.android.contacts
desired_caps[‘noReset’] = True
desired_caps[‘autoGrantPermissions’] = True