def __fix_context(context):
    """Return a new context dict based on original context.

    The new context will be a copy of the original, and some mutable
    members (such as script and css files) will also be copied to
    prevent polluting shared context.
    """

    COPY_LISTS = ('script_files', 'css_files',)

    for attr in COPY_LISTS:
        if attr in context:
            context[attr] = context[attr][:]

    return context
Return a new context dict based on original context.

    The new context will be a copy of the original, and some mutable
    members (such as script and css files) will also be copied to
    prevent polluting shared context.