def get_attribute(element, attribute_name):
    """Low level method to extract an attribute from a node allowing for various
    cases.

    Expected cases: - No attributes for this node --> None - Attributes exist
    but requested one doesn't. --> None - Requested attribute does exist. -->
    Value (as string).

    Args:
        element: ElementTree Element
        attribute_name: name of attribute to extract from element.

    Returns:
        - Value of element if it exists.
        - None otherwise.
    """
    attributes = getattr(element, 'attrib', {})
    if attribute_name not in attributes:
        return None
    else:
        return attributes[attribute_name]
