def get_installed_pypackages():
    return {p.project_name.lower(): p for p in pkg_resources.working_set}
def badmatch(match, badfn):
    """Make a copy of the given matcher, replacing its bad method with the given
    one.
    """
    m = copy.copy(match)
    m.bad = badfn
    return m