def METHOD_NAME(input_, fn):
    """
    Apply fn to each element in input_. input_ may be a list, tuple, slice, or dict with string keys.
    Args:
        input_: the input whose elements are to be mapped by fn
        fn: the Callable to transform the elements
    Returns:
        The input_ whose elements are transformed by fn
    """
    if isinstance(input_, tuple):
        t = tuple(METHOD_NAME(elem, fn) for elem in input_)
        # Support NamedTuple (if it has `_fields`) by repacking into original type.
        return t if not hasattr(input_, "_fields") else type(input_)(*t)
    elif isinstance(input_, list):
        return list(METHOD_NAME(elem, fn) for elem in input_)
    elif isinstance(input_, dict):
        return dict((k, METHOD_NAME(v, fn)) for k, v in input_.items())
    elif isinstance(input_, slice):
        return slice(METHOD_NAME(input_.start, fn), METHOD_NAME(input_.stop, fn), METHOD_NAME(input_.step, fn))
    else:
        return fn(input_)