code: def class_result(classname):
      
      def wrap_errcheck(result, func, arguments):
          if result is None:
              return None
          return classname(result)
      return wrap_errcheck
docs: Errcheck function. Returns a function that creates the specified class.