def convert_kwargs_to_tags()

in deploy/ansible/filter_plugins/custom_filters.py [0:0]


def convert_kwargs_to_tags(kwargs):
    if not kwargs or len(kwargs) == 0:
        print(f"Invalid parameter kwargs={kwargs}")
        return set()
    try:
        tokens = set()
        for key,value in kwargs.items():
            token = key.strip()+"="+value.strip()
            tokens.add(token)
        return tokens
    except Exception:
        # return empty set in case anything goes wrong
        print("encountered exception while converting kwargs to tags")
        traceback.print_exec()
        return set()