code: def _complete_statement(self, line: str) -> Statement:
          
          while True:
              try:
                  statement = self.statement_parser.parse(line)
                  if statement.multiline_command and statement.terminator:
                      # we have a completed multiline command, we are done
                      break
                  if not statement.multiline_command:
                      # it's not a multiline command, but we parsed it ok
                      # so we are done
                      break
              except ValueError:
                  # we have unclosed quotation marks, lets parse only the command
                  # and see if it's a multiline
                  statement = self.statement_parser.parse_command_only(line)
                  if not statement.multiline_command:
                      # not a multiline command, so raise the exception
                      raise
  
              # if we get here we must have:
              #   - a multiline command with no terminator
              #   - a multiline command with unclosed quotation marks
              try:
                  self.at_continuation_prompt = True
                  newline = self.pseudo_raw_input(self.continuation_prompt)
                  if newline == 'eof':
                      # they entered either a blank line, or we hit an EOF
                      # for some other reason. Turn the literal 'eof'
                      # into a blank line, which serves as a command
                      # terminator
                      newline = '\n'
                      self.poutput(newline)
                  line = '{}\n{}'.format(statement.raw, newline)
              except KeyboardInterrupt as ex:
                  if self.quit_on_sigint:
                      raise ex
                  else:
                      self.poutput('^C')
                      statement = self.statement_parser.parse('')
                      break
              finally:
                  self.at_continuation_prompt = False
  
          if not statement.command:
              raise EmptyStatement()
          return statement
docs: Keep accepting lines of input until the command is complete.
  
          There is some pretty hacky code here to handle some quirks of
          self.pseudo_raw_input(). It returns a literal 'eof' if the input
          pipe runs out. We can't refactor it because we need to retain
          backwards compatibility with the standard library version of cmd.