Hi narsimha If I understand correctly, you are looking for Azure Python SDK or Azure rest api to list unsupported VM Sizes in azure as listed in "all sizes" blade like shown in below screenshot?
There is no direct Azure Python SDK or Rest API for this. You can check the following Stack question which is like your requirement
https://stackoverflow.com/questions/69661889/in-azure-i-wanted-to-get-sku-list-for-a-specific-vm-using-python-sdk
If you would like to further check you can try contacting Microsoft support for further assistance.