code: def requires_properties(properties):
      @decorator
      def _requires_properties(func, *args, **kwargs):
          params = util.map_parameters_in_fn_call(args, kwargs, func)
          obj = params.get("self")
  
          if obj is None:
              raise Exception(
                  "This decorator only works on instance methods"
              )
  
          missing = [p for p in properties if getattr(obj, p) is None]
  
          if len(missing):
              raise ValueError(
                  "{} requires {} to be set, missing: {}".format(
                      func.__name__, properties, missing
                  )
              )
  
          return func(*args, **kwargs)
  
      return _requires_properties
  
imports: from decorator import decorator
  import matplotlib.pyplot
  from sklearn_evaluation import util
label_desc: Use image node_id 2 for calling a global function with example usage: requires_properties(properties) and returns: _requires_properties, func