import re


def materialize(template, substitutions):
    """
    Creates pig script by performing substitutions in the template.

    :type template: str
    :param template: Pig script template

    :type substitutions: dict
    :param substitutions: Dictionary of substitutions

    :rtype: str
    :return: Materialized pig script
    """

    script_str = template
    for param, value in substitutions.items():
        script_str = re.sub(param, str(value), script_str)

    return script_str