import inspect


def lengths_arg_exists(func):
    """Returns True if func takes ``lengths`` keyword argument.

    Arguments
    ---------
    func : callable
        The function, method, or other callable to search for the lengths arg.
    """
    spec = inspect.getfullargspec(func)
    return "lengths" in spec.args + spec.kwonlyargs