Calls the provided method if it is defined.

    Returns default if not defined.

def method_call_if_def(obj, attr_name, m_name, default, *args, **kwargs):
    """Calls the provided method if it is defined.

    Returns default if not defined.
    """
    try:
        attr = getattr(obj, attr_name)
    except AttributeError:
        return default
    else:
        return getattr(attr, m_name)(*args, **kwargs)