Fix Python – boto3 client NoRegionError: You must specify a region error only sometimes

I have a boto3 client :
boto3.client(‘kms’)

But it happens on new machines, They open and close dynamically.
if endpoint is None:
if region_name is None:
# Raise a more specific error message that will give
# better guidance to the user what needs to happen.
raise NoRegionError()

Why is this happe….