def get_entity_id_attribute(self, entity, id_attribute_name = "object_id"):
    """
    Retrieves the id attribute (value) from the given entity that may
    be both an entity object or an entity map represented by a dictionary.
    In case the given entity is a map the id attribute name value is used
    to retrieve the appropriate id attribute value.
    This method must be used carefully to avoid possible miss conversion
    of id attribute based on an erroneous id attribute name.

    :type entity: Entity
    :param entity: The entity to retrieve the id attribute, this value
    may assume a possible map value.
    :type id_attribute_name: String
    :param id_attribute_name: The name of the id attribute, this value
    is only used in case the provided entity is a map.
    :rtype: Object
    :return: The value of the entity id attribute for the given entity.
    """

    # retrieves the entity type,
    entity_type = type(entity)

    # in case the entity type is a dictionary, must
    # retrieve the id attribute using as reference the
    # given id attribute name
    if entity_type == dict:
        # retrieves the id attribute value from the entity (map)
        # using the provided id attribute name
        id_attribute_value = entity.get(id_attribute_name, None)
    # in case the entity type is not a dictionary it must
    # be a normal entity object, normal strategy applies
    else:
        # retrieves the id attribute value "directly"
        # from the entity
        id_attribute_value = entity.get_id_attribute_value()

    # returns the retrieved id attribute value
    return id_attribute_value