def username_exists(username): try: sh.id(username) except sh.ErrorReturnCode_1: return False else: return True