common virsh execution function

def execute_virsh_command(self,
                              **kwargs):
        '''
        common virsh execution function
        '''
        host_list = kwargs.get('host_list', None)
        remote_user = kwargs.get('remote_user', None)
        remote_pass = kwargs.get('remote_pass', None)
        sudo = kwargs.get('sudo', False)
        sudo_user = kwargs.get('sudo_user', None)
        sudo_pass = kwargs.get('sudo_pass', None)

        host_list, remote_user, remote_pass, \
            sudo, sudo_user, sudo_pass = self.get_validated_params(
                host_list, remote_user,
                remote_pass, sudo,
                sudo_user, sudo_pass)

        if 'cmd' not in kwargs.keys():
            print "Require a command to execute"
            return None
        cmd = kwargs['cmd']

        if 'delimiter' not in kwargs.keys():
            delimiter = ":"
        else:
            delimiter = kwargs['delimiter']

        if 'output_type' not in kwargs.keys():
            output_type = "LRVALUE"
        else:
            output_type = kwargs['output_type']

        if output_type == "TABLE":
            if 'fields' not in kwargs.keys():
                print "Require to pass fields"
                return None

        fields = kwargs['fields']

        result, failed_hosts = self.runner.ansible_perform_operation(
            host_list=host_list,
            remote_user=remote_user,
            remote_pass=remote_pass,
            module="command",
            module_args=cmd,
            sudo=sudo,
            sudo_user=sudo_user,
            sudo_pass=sudo_pass)

        virsh_result = None
        if result['contacted'].keys():
            virsh_result = {}
            for node in result['contacted'].keys():
                nodeobj = result['contacted'][node]
                if output_type == "LRVALUE":
                    jsonoutput = rex.parse_lrvalue_string(nodeobj['stdout'],
                                                          delimiter)
                elif output_type == "TABLE":
                    jsonoutput = rex.parse_tabular_string(nodeobj['stdout'],
                                                          fields)
                else:
                    pass
                virsh_result[node] = {}
                virsh_result[node]['result'] = jsonoutput

        return virsh_result