def get_extra_rules(use_extra: bool, extra_json_path: Path_Str) -> Optional[ActionsDict]:
    'Helper to provide custom (project level/user level) anonymization\n    rules as a mapping of tags -> action function.\n\n    Args:\n        use_extra (bool): If use extra rules.\n        extra_json_path (Path_Str): Path to extra rules json file.\n        It should be flat json with action as a key and list of tags as value.\n\n    Returns:\n        Optional[ActionsDict]: extra rules mapping (tags -> action function)\n    '
    extra_rules = None
    if use_extra:
        with open(extra_json_path, 'r') as fout:
            extra_rules = json.load(fout)
        for key in extra_rules:
            tag_list = extra_rules[key]
            tag_list = [tuple(elem) for elem in tag_list]
            extra_rules[key] = tag_list
        extra_rules = initialize_actions(extra_rules)
    return extra_rules
Helper to provide custom (project level/user level) anonymization
rules as a mapping of tags -> action function.

Args:
    use_extra (bool): If use extra rules.
    extra_json_path (Path_Str): Path to extra rules json file.
    It should be flat json with action as a key and list of tags as value.

Returns:
    Optional[ActionsDict]: extra rules mapping (tags -> action function)
def get_extra_rules(use_extra: bool, extra_json_path: Path_Str) -> Optional[ActionsDict]:
    'Helper to provide custom (project level/user level) anonymization\n    rules as a mapping of tags -> action function.\n\n    Args:\n        use_extra (bool): If use extra rules.\n        extra_json_path (Path_Str): Path to extra rules json file.\n        It should be flat json with action as a key and list of tags as value.\n\n    Returns:\n        Optional[ActionsDict]: extra rules mapping (tags -> action function)\n    '
    extra_rules = None
    if use_extra:
        with open(extra_json_path, 'r') as fout:
            extra_rules = json.load(fout)
        for key in extra_rules:
            tag_list = extra_rules[key]
            tag_list = [tuple(elem) for elem in tag_list]
            extra_rules[key] = tag_list
        extra_rules = initialize_actions(extra_rules)
    return extra_rules