def is_git_sha(text):
 if (len(text) in (40, 7)):
  try:
   int(text, 16)
   return True
  except ValueError:
   pass
 return False

def is_git_sha ( text ) : if ( len ( text ) in ( 40 , 7 ) ) : try : int ( text , 16 ) return True except ValueError : pass return False
return whether this is probably a git sha .