def call_filter(to_call, value, base):
    """
    Encapsulates the logic for handling callables in the filter.
    Call the callable to_call with value and possibly base.
    """

    # Callables can take either one or two values
    try:
        return to_call(value, base)
    except TypeError:
        return to_call(value)