How to swipe right and then up when initializing the driver?

I use Python to connect to my phone but I need to unlock it using pattern.

Before that, I need to swipe the screen from left to right and then up.

Here is my original code:

desired_caps = {‘platformName’: ‘Android’, ‘platformVersion’: ‘6.0.1’, ‘deviceName’: ‘myphone’, ‘noReset’: ‘true’,
‘appPackage’: ‘com.whatsapp’, ‘appActivity’: ‘com.whatsapp.HomeActivity’, ‘unicodeKeyboard’: ‘true’,
‘resetKeyboard’: ‘true’, ‘newCommandTimeout’: 9999, “unlockType”: “pattern”, “unlockKey”: “123456”}

driver = webdriver.Remote(‘http://localhost:4723/wd/hub’, desired_caps)

The program stops because it cannot swipe right and up before inputting the pattern.

How to solve this problem?

Thanks a lot.