code: def commit_check(self, commands="", req_format="text"):
          
          if not commands:
              raise InvalidCommandError('No commands specified')
          clean_cmds = []
          for cmd in clean_lines(commands):
              clean_cmds.append(cmd)
          self.lock()
          self._session.load_configuration(action='set', config=clean_cmds)
          # conn.validate() DOES NOT return a parse-able xml tree, so we
          # convert it to an ElementTree xml tree.
          results = ET.fromstring(self._session.validate(
              source='candidate').tostring)
          # release the candidate configuration
          self.unlock()
          if req_format == "xml":
              return ET.tostring(results)
          out = ""
          # we have to parse the elementTree object, and get the text
          # from the xml.
          for i in results.iter():
              # the success message is just a tag, so we need to get it
              # specifically.
              if i.tag == 'commit-check-success':
                  out += 'configuration check succeeds\n'
              # this is for normal output with a tag and inner text, it will
              # strip the inner text and add it to the output.
              elif i.text is not None:
                  if i.text.strip() + '\n' != '\n':
                      out += i.text.strip() + '\n'
              # this is for elements that don't have inner text, it will add the
              # tag to the output.
              elif i.text is None:
                  if i.tag + '\n' != '\n':
                      out += i.tag + '\n'
          return out
docs: Execute a commit check operation.
  
          Purpose: This method will take in string of multiple commands,
                 | and perform and 'commit check' on the device to ensure
                 | the commands are syntactically correct. The response can
                 | be formatted as text or as xml.
  
          @param commands: A string, filepath, or list of multiple commands
                         | that the device will compare with.
          @type commands: str or list
          @param req_format: The desired format of the response, defaults to
                           | 'text', but also accepts 'xml'
          @type req_format: str
  
          @returns: The reply from the device.
          @rtype: str