code: def optional(type_):
      """
      Helper for use with `expect_types` when an input can be `type_` or `None`.
  
      Returns an object such that both `None` and instances of `type_` pass
      checks of the form `isinstance(obj, optional(type_))`.
  
      Parameters
      ----------
      type_ : type
         Type for which to produce an option.
  
      Examples
      --------
      >>> isinstance({}, optional(dict))
      True
      >>> isinstance(None, optional(dict))
      True
      >>> isinstance(1, optional(dict))
      False
      """
      return (type_, type(None))
  
imports: from datetime import tzinfo
  from functools import partial
  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 zipline.utils.compat import wraps
  from zipline.utils.functional import getattrs
  from zipline.utils.preprocess import call, preprocess
label_desc: Use image node_id 11 for calling a global function with example usage: optional(type_) and returns: type_,  type