def condify_name(name, name_replacements=None):
    """Given a name, replace the package name with its entry, if any, in the dict
    name_replacements, otherwise make the package name lowercase and replace,
    underscores with hyphens."""
    if name_replacements is None:
        name_replacements = {}
    return name_replacements.get(name, name.lower().replace("_", "-"))