import re


def format_kwargs(string, *args):
    """Return set or dict (optional) of keyword arguments ({keyword}) in provided text"""
    keywords = {x.strip('{}') for x in re.findall(r'((?<!{){(?!{).*?(?<!})}(?!}))', string)}
    if args and args[0] == "dict":
        return {sub: "" for sub in keywords}
    return keywords