def getid(obj):
 try:
  return obj.id
 except AttributeError:
  return obj

def getid ( obj ) : try : return obj . id except AttributeError : return obj
convert one or both of a string representation of a uid and gid into integer form .