python – how to get the list of all the users of all the databases in mongodb using pymongo command?

db.command(‘usersInfo’)

The above command gives list of users in the database in which the command is run.

command_result = db.command(
{
‘usersInfo’: {‘user’: ‘user’, ‘db’: ‘mydatabase’},
‘showPrivileges’: True
} )

the above code gives information about the user in the ‘mydatabase’ database.
But i want to list all the users in all the databases. can anyone tell me what command i can use in python for that?

s = myclient.admin.command({‘usersInfo’ :{‘forAllDBs: true’}})
print(s)

when i am using above command i am getting error. i am using pymongo