code: def optionally(preprocessor):
      """Modify a preprocessor to explicitly allow `None`.
  
      Parameters
      ----------
      preprocessor : callable[callable, str, any -> any]
          A preprocessor to delegate to when `arg is not None`.
  
      Returns
      -------
      optional_preprocessor : callable[callable, str, any -> any]
          A preprocessor that delegates to `preprocessor` when `arg is not None`.
  
      Examples
      --------
      >>> def preprocessor(func, argname, arg):
      ...     if not isinstance(arg, int):
      ...         raise TypeError('arg must be int')
      ...     return arg
      ...
      >>> @preprocess(a=optionally(preprocessor))
      ... def f(a):
      ...     return a
      ...
      >>> f(1)  # call with int
      1
      >>> f('a')  # call with not int
      Traceback (most recent call last):
         ...
      TypeError: arg must be int
      >>> f(None) is None  # call with explicit None
      True
      """
  
      @wraps(preprocessor)
      def wrapper(func, argname, arg):
          return (
              arg if arg is None else preprocessor(func, argname, arg)
          )
  
      return wrapper
  
imports: from datetime import tzinfo
  from functools import partial, wraps
  from operator import attrgetter
  from numpy import dtype
  import pandas
  from pytz import timezone
  from six import iteritems, string_types, PY3
  from toolz import valmap, complement, compose
  import toolz.curried.operator
  from catalyst.utils.functional import getattrs
  from catalyst.utils.preprocess import call, preprocess
label_desc: Use image node_id 2 for calling a global function with example usage: optionally(preprocessor) and returns: wrapper, unknown