def clean()

in cfn_clean/__init__.py [0:0]


def clean(source):
    """
    Clean up the source:
    * Replace use of Fn::Join with Fn::Sub
    * Keep json body for specific resource properties
    """

    if isinstance(source, dict):
        for key, value in source.items():
            if key == "Fn::Join":
                return convert_join(value)

            else:
                source[key] = clean(value)

    elif isinstance(source, list):
        return [clean(item) for item in source]

    return source