Hello @Gorantla Srikanth
welcome to this moderated Azure community forum.
Microsoft provides an Python SDK for connecting Azure IoT devices.
Check out my blog post about the basics working with the SDK.
I also added this GitHub example with DPS support.
Notice the extra 'IoTHubDeviceClient.create_from_symmetric_key()' command.
Please check out the example first and then try to merge it with your code.
If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.