import inspect


def requires_request_arg(method):
    """
    Helper function to handle deprecation of old ActionMenuItem API where get_url, is_show,
    get_context and render_html all accepted both 'request' and 'parent_context' as arguments
    """
    try:
        # see if this is a pre-2.15 get_url method that takes both request and context kwargs
        inspect.signature(method).bind({})
    except TypeError:
        return True
    else:
        return False