code: def create_option(name, ty, docstring, default_factory=lambda: None):
      """Creates a type-checked property.
  
      Args:
        name: The name to use.
        ty: The type to use. The type of the property will be validated when it
          is set.
        docstring: The docstring to use.
        default_factory: A callable that takes no arguments and returns a default
          value to use if not set.
  
      Returns:
        A type-checked property.
      """
  
      def get_fn(option):
          # pylint: disable=protected-access
          if name not in option._options:
              option._options[name] = default_factory()
          return option._options.get(name)
  
      def set_fn(option, value):
          if not isinstance(value, ty):
              raise TypeError(
                  'Property "{}" must be of type {}, got: {} (type: {})'.format(
                      name, ty, value, type(value)
                  )
              )
          option._options[
              name
          ] = value  # pylint: disable=protected-access
  
      return property(get_fn, set_fn, None, docstring)
  
file_path: tensorflow/tensorflow/python/data/util/options.py
imports: import collections
  from absl import logging
label_desc: Use image node_id 3 for calling a global function with example usage: create_option(name, ty, docstring, default_factory) and returns: property, option