import inspect


def get_kernel_from_graph(graph, kernel_method, normalized=False):
    """Get kernel from graph given a kernel method."""
    if 'normalized' in inspect.getfullargspec(kernel_method).args:
        return kernel_method(graph, normalized=normalized)
    else:
        return kernel_method(graph)