def get_category(rule):
    """Return the rule category name."""
    if isinstance(rule['category'], dict):
        if 'base' in rule['category']:
            return rule['category']['base']
        # Keys are the languages that the category name is translated in.
        # Return the first translation.
        return rule['category'].values()[0]
    return rule['category']