import functools


def or_none(fn):
    """
    Wraps `fn` to return `None` if its first argument is `None`.

      >>> @or_none
      ... def myfunc(x):
      ...     return 2 * x + 3

      >>> myfunc(4)
      11
      >>> myfunc(None)

    """
    @functools.wraps(fn)
    def wrapped(arg, *args, **kw_args):
        return None if arg is None else fn(arg, *args, **kw_args)

    return wrapped