code: def read_from_file(path, file_type='text', exception=ScriptWorkerException):
      
      FILE_TYPE_MAP = {'text': 'r', 'binary': 'rb'}
      if file_type not in FILE_TYPE_MAP:
          raise exception("Unknown file_type {} not in {}!".format(file_type, FILE_TYPE_MAP))
      try:
          with open(path, FILE_TYPE_MAP[file_type]) as fh:
              return fh.read()
      except (OSError, FileNotFoundError) as exc:
          raise exception("Can't read_from_file {}: {}".format(path, str(exc)))
docs: Read from ``path``.
  
      Small helper function to read from ``file``.
  
      Args:
          path (str): the path to read from.
          file_type (str, optional): the type of file. Currently accepts
              ``text`` or ``binary``. Defaults to ``text``.
          exception (Exception, optional): the exception to raise
              if unable to read from the file.  Defaults to ``ScriptWorkerException``.
  
      Returns:
          None: if unable to read from ``path`` and ``exception`` is ``None``
          str or bytes: the contents of ``path``
  
      Raises:
          Exception: if ``exception`` is set.