code: def compare_config(self, commands="", req_format="text"):
          
          if not commands:
              raise InvalidCommandError('No commands specified')
          clean_cmds = [cmd for cmd in clean_lines(commands)]
          self.lock()
          self._session.load_configuration(action='set', config=clean_cmds)
          out = self._session.compare_configuration()
          self.unlock()
          if req_format.lower() == "xml":
              return out
          return out.xpath(
              'configuration-information/configuration-output')[0].text
docs: Execute a 'show | compare' against the specified commands.
  
          Purpose: This method will take in string of multiple commands,
                 | and perform and 'show | compare' on the device to show the
                 | differences between the active running configuration and
                 | the changes proposed by the passed commands parameter.
  
          @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