def print_xm_info(xm_dict, name_re):
    """Print a dictionary of xmethods."""
    def get_status_string(m):
        if not m.enabled:
            return " [disabled]"
        else:
          return ""

    if not xm_dict:
        return
    for locus_str in xm_dict:
        if not xm_dict[locus_str]:
            continue
        print ("Xmethods in %s:" % locus_str)
        for matcher in xm_dict[locus_str]:
            print ("  %s%s" % (matcher.name, get_status_string(matcher)))
            if not matcher.methods:
                continue
            for m in matcher.methods:
                if name_re is None or name_re.match(m.name):
                    print ("    %s%s" % (m.name, get_status_string(m)))