human
Complete the below
def cmdparser(raw_string, cmdset, caller, match_index=None):

    ''''This function is called by the cmdhandler once it has
    gathered and merged all valid cmdsets valid for this particular parsing.
    Args:
    raw_string (str): The unparsed text entered by the caller.
    cmdset (CmdSet): The merged, currently valid cmdset
    caller (Session, Player or Object): The caller triggering this parsing.
    match_index (int, optional): Index to pick a given match in a
    list of same-named command matches. If this is given, it suggests
    this is not the first time this function was called: normally
    the first run resulted in a multimatch, and the index is given
    to select between the results for the second run.
    Notes:
    The cmdparser understand the following command combinations (where
    [] marks optional parts.
    [cmdname[ cmdname2 cmdname3 ...] [the rest]
    A command may consist of any number of space-separated words of any
    length, and contain any character. It may also be empty.
    The parser makes use of the cmdset to find command candidates. The
    parser return a list of matches. Each match is a tuple with its
    first three elements being the parsed cmdname (lower case),
    the remaining arguments, and the matched cmdobject from the cmdset.'
    '''
assistant
#Here is Python code to find command candidates.
    def create_match(cmdname, string, cmdobj):
        "\n                                Builds    a    command    match    by    splitting    the    incoming    string    and\n                                evaluating    the    quality    of    the    match.\n\n                                Args:\n                                                cmdname    (str):    Name    of    command    to    check    for.\n                                                string    (str):    The    string    to    match    against.\n                                                cmdobj    (str):    The    full    Command    instance.\n\n                                Returns:\n                                                match    (tuple):    This    is    on    the    form    (cmdname,    args,    cmdobj,    cmdlen,    mratio),    where\n                                                                `cmdname`    is    the    command's    name    and    `args`    the    rest    of    the    incoming    string,\n                                                                without    said    command    name.    `cmdobj`    is    the    Command    instance,    the    cmdlen    is\n                                                                the    same    as    len(cmdname)    and    mratio    is    a    measure    of    how    big    a    part    of    the\n                                                                full    input    string    the    cmdname    takes    up    -    an    exact    match    would    be    1.0.\n\n                                "
        (cmdlen, strlen) = (len(unicode(cmdname)), len(unicode(string)))
        mratio = (1 - ((strlen - cmdlen) / (1.0 * strlen)))
        args = string[cmdlen:]
        return (cmdname, args, cmdobj, cmdlen, mratio)
    if (not raw_string):
        return []
    matches = []
    l_raw_string = raw_string.lower()
    for cmd in cmdset:
        try:
            matches.extend([create_match(cmdname, raw_string, cmd) for cmdname in ([cmd.key] +...