def wcag_refs(code):
    """
    Given a `code` from pa11y, return a list of the WCAG references.
    These references are always of the form: one or more capital letters,
    followed by one or more digits. One `code` may contain multiple
    references, separated by commas.
    """
    bits = code.split(".")
    for bit in reversed(bits):
        if WCAG_REFS_RE.match(bit):
            return bit.split(",")
    return []