def _get_identifier(obj):
    """
    Gets the name of the identifier defined by an object with either an 'identifier' attribute or
    a 'typed_identifier' attribute.
    """
    if hasattr(obj, 'identifier'):
        return obj.identifier
    if hasattr(obj, 'typed_identifier'):
        return obj.typed_identifier
    raise AttributeError(
        f"Object of type '{type(obj).__name__}' has no 'identifier' or 'typed_identifier'.")