def extract_command(func):
def mock(_, commands, ip=None):<EOL><INDENT>if ip is None:<EOL><INDENT>pre = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>pre = '<STR_LIT>'.format(ip)<EOL><DEDENT>return pre + '<STR_LIT:U+0020>'.join(map(six.text_type, commands))<EOL><DEDENT>@functools.wraps(func)<EOL>@patch(target='<STR_LIT>', new=mock)<EOL>@patch(target='<STR_LIT>', new=mock)<EOL>def func_wrapper(self):<EOL><INDENT>return func(self)<EOL><DEDENT>return func_wrapper<EOL>
patch `CliClient.execute` method for unittest

    Patch `CliClient.execute` to return the parameters.
    The command line parameter can be verified by unittest.

    :param func: test function to wrap