<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compare_config(self, commands="", req_format="text"):
 """ 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 """

        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