def hasattr_or_fallback(obj, attribute, fallback):

    """Returns given object's attribute if it exists else
    returns given fallback

    Args:
        obj (obj): object on which we ask whether it has an attribute
        attribute (obj): attribute we ask if exists in object
        fallback (Any): value returned if object doesn't have asked attribute

    Returns:
        (Any): object's attrubte value
            or
        (Any): value set as fallback
    """

    if hasattr(obj, attribute):
        return obj[attribute]
    else:
        return fallback