Parse an alias rule.  The first token is the canonical name of the
    version.  The remaining tokens are key="quoted value" pairs that
    specify parameters; these parameters are ignored by AVersion, but
    may be used by the application.

    :param alias: The alias name.
    :param alias_spec: The alias text, described above.

    :returns: A dictionary of three keys: "alias" is the alias name;
              "version" is the canonical version identification
              string; and "params" is a dictionary of parameters.

def _parse_alias_rule(alias, alias_spec):
    """
    Parse an alias rule.  The first token is the canonical name of the
    version.  The remaining tokens are key="quoted value" pairs that
    specify parameters; these parameters are ignored by AVersion, but
    may be used by the application.

    :param alias: The alias name.
    :param alias_spec: The alias text, described above.

    :returns: A dictionary of three keys: "alias" is the alias name;
              "version" is the canonical version identification
              string; and "params" is a dictionary of parameters.
    """

    result = dict(alias=alias, params={})
    for token in quoted_split(alias_spec, ' ', quotes='"\''):
        if not token:
            continue

        # Suck out the canonical version name
        if 'version' not in result:
            result['version'] = token
            continue

        # What remains is key="quoted value" pairs...
        key, _eq, value = token.partition('=')

        # Set the parameter key
        _set_key('alias.%s' % alias, result['params'], key, value)

    # Make sure we have a canonical version
    if 'version' not in result:
        raise KeyError("Cannot determine canonical version for alias %r" %
                       alias)

    return result