code: def get_reporter(reporter):
      """Returns a reporter based on what was passed as argument. If reporter is already
      a reporter then it is returned. Otherwise, an appropriate reporter is constructed
      and returned."""
      if six.PY2:
          file_types = file, io.IOBase
      else:
          file_types = (io.IOBase,)
  
      if isinstance(reporter, str):
          if reporter.lower() == "default":
              reporter = BasicReporter()
          elif reporter.lower() == "silent":
              reporter = SilentReporter()
          else:
              raise ValueError(
                  'If reporter is string, it should be "default" or "silent".'
              )
      elif isinstance(reporter, file_types):
          return BasicReporter(reporter)
      elif reporter is None:
          reporter = SilentReporter()
      elif not isinstance(reporter, BasicReporter):
          raise ValueError(
              "Pass either a string, BasicReporter or None for reporter. "
          )
      return reporter
  
file_path: dragonfly/dragonfly/utils/reporters.py
imports: import sys
  import six
  import io
label_desc: Use image node_id 1 for calling a global function with example usage: get_reporter(reporter) and returns: reporter, BasicReporter