def is_entity(key):
 key_parts = key.split(KEY_DELIMITER)
 if (len(key_parts) != 3):
  return False
 last_part = key_parts[(-1)]
 if (not last_part.endswith(KIND_SEPARATOR)):
  return False
 last_part = last_part[:(- len(KIND_SEPARATOR))]
 if (KIND_SEPARATOR in last_part):
  return False
 return (':' in last_part)

def is_entity ( key ) : key_parts = key . split ( KEY_DELIMITER ) if ( len ( key_parts ) != 3 ) : return False last_part = key_parts [ ( - 1 ) ] if ( not last_part . endswith ( KIND_SEPARATOR ) ) : return False last_part = last_part [ : ( - len ( KIND_SEPARATOR ) ) ] if ( KIND_SEPARATOR in last_part ) : return False return ( ':' in last_part )
determines whether a given string is an entity key .