def parse_name(name):
    name = name.strip()
    if not name:
        return []
    try:
        items = [(NAME_CASE_MAPPINGS[t[0].upper()], force_text(t[2])) for t in NAME_RE.findall(name)]
    except KeyError as e:
        raise ValueError('Unknown x509 name field: %s' % e.args[0])
    for key, oid in NAME_OID_MAPPINGS.items():
        if sum(1 for t in items if t[0] == key) > 1 and oid not in MULTIPLE_OIDS:
            raise ValueError('Subject contains multiple "%s" fields' % key)
    return sort_name(items)