def _Error(self, result, error, lineno=None):
    """Prints an error message. Used by both Log and Error on bad results.

    Args:
      result: The vroom.test.RESULT.
      error: The execption.
      lineno: The place that the error occured, if known.
    """
    self.Queue('------------------------------------------------', verbose=True)
    if result == vroom.test.RESULT.ERROR:
      self.Queue(result.upper(), color=COLORS[STATUS.ERROR], end='')
    else:
      self.Queue(result.upper(), color=COLORS[STATUS.FAIL], end='')
    if lineno is not None:
      self.Queue(' on line %s' % self.Lineno(lineno), verbose=False, end='')
    self.Queue(': ', end='')
    self.Queue(str(error))
    # Print extra context about the error.
    # Python isinstance is freeking pathological: isinstance(foo, Foo) can
    # change depending upon how you import Foo.  Instead of dealing with that
    # mess, we ducktype exceptions.
    # Also, python can't do real closures, which is why contexted is a list.
    contexted = [False]

    def QueueContext(attr, writer, *args):
      value = None
      if hasattr(error, attr):
        value = getattr(error, attr)
      elif hasattr(error, 'GetFlattenedFailures'):
        for f in error.GetFlattenedFailures():
          if hasattr(f, attr):
            value = getattr(f, attr)
            break
      if value is None:
        return
      contexted[0] = True
      self.Queue('')
      writer(value, self.Queue, *args)

    QueueContext('messages', ErrorMessageContext)
    QueueContext('context', ErrorBufferContext)

    if lineno is not None:
      stripped = self._lines[lineno][2:]
      line = '\nFailed command on line %s:\n%s' % (
          self.Lineno(lineno), stripped)
      self.Queue(line, end='', verbose=False)

    QueueContext('expectations', ErrorShellQueue)
    QueueContext('syscalls', ErrorSystemCalls)
    QueueContext('commands', ErrorCommandContext)

    if contexted[0]:
      self.Queue('', verbose=False)
    self.Queue('------------------------------------------------', verbose=True)
dataset/ETHPy150Open google/vroom/vroom/output.py/ActionLogger._Error/original