@contextfilter
def arg_filter(ctx, value, prefix=None, suffix=None):
    try:
        value = __resolve_options(ctx, value)
        if not isinstance(value, Option):
            if not value:
                return ""
            v = str(value)
            prefix = prefix if prefix is not None else ""
            suffix = suffix if suffix is not None else ""
            return "%s%s%s" % (prefix, v, suffix)

        if value.to_cmd() == "":
            return ""

        v = value.get()
        original = prefix
        prefix = prefix if prefix is not None else value.get_opt()
        suffix = suffix if suffix is not None else ""
        # we add a space between the prefix and the value if there was
        # no user specified prefix and we used the values get_opt()
        space = "" if (original is not None or not v) else " "
        return "%s%s%s%s" % (prefix, space, v, suffix)
    except:
        return value
dataset/ETHPy150Open thasso/pyjip/jip/templates.py/arg_filter/original