import os

# check

if 'HOME' in os.environ:
    print("Yes!")

# read
print(os.environ.get('HOME', '/home/ubuntu'))