<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def command(jaide, commands, format="text", xpath=False):
 """ Run an operational command. @param jaide: The jaide connection to the device. @type jaide: jaide.Jaide object @param commands: the operational commands to send to the device. @type commands: str or list @param format: The desired output format from the device, either 'text' | or 'xml' is supported. @type format: str @param xpath: The xpath expression to filter the results from the device. | If set, this forces the output to be requested in xml format. @type xpath: str @returns: The output from the device, and xpath filtered if desired. @rtype: str """

    output = ""
    for cmd in clean_lines(commands):
        expression = ""
        output += color('> ' + cmd + '\n', 'yel')
        # Get xpath expression from the command, if it is there.
        # If there is an xpath expr, the output will be xml,
        # overriding the req_format parameter
        #
        # Example command forcing xpath: show route % //rt-entry
        if len(cmd.split('%')) == 2:
            expression = cmd.split('%')[1].strip()
            cmd = cmd.split('%')[0] + '\n'
        elif xpath is not False:
            expression = xpath
        if expression:
            try:
                output += jaide.op_cmd(command=cmd, req_format='xml',
                                       xpath_expr=expression) + '\n'
            except lxml.etree.XMLSyntaxError:
                output += color('Xpath expression resulted in no response.\n',
                                'red')
        else:
            output += jaide.op_cmd(cmd, req_format=format) + '\n'
    return output