def get_entity_by_type_and_id(entity_type, entity_id):
  """Return the datastore object with the given type and id if it exists."""
  if not entity_id or not str(entity_id).isdigit() or int(entity_id) == 0:
    return None

  return entity_type.get_by_id(int(entity_id))