Decorator which wraps a single argument function to ignore any
    arguments of primitive type (simply returning them unmodified).

def return_primitive(fn):
    """
    Decorator which wraps a single argument function to ignore any
    arguments of primitive type (simply returning them unmodified).
    """
    @wraps(fn)
    def wrapped_fn(x):
        if isinstance(x, PRIMITIVE_TYPES):
            return x
        return fn(x)
    return wrapped_fn