from textwrap import dedent


def package_load_instructions(inst_distributions):
    """Load instructions, displayed in the package notes"""

    per_package_inst = ''

    for dist in inst_distributions:

        if dist.type == 'zip':
            per_package_inst += dedent(
                """
                # Loading the ZIP Package

                Zip packages are compressed, so large resources may load faster.

                    import metapack as mp
                    pkg = mp.open_package('{url}')

                """.format(url=dist.package_url.inner))

        elif dist.type == 'csv':
            per_package_inst += dedent(
                """
                # Loading the CSV Package

                CSV packages load resources individually, so small resources may load faster.


                    import metapack as mp
                    pkg = mp.open_package('{url}')

                """.format(url=dist.package_url.inner))

    if per_package_inst:

        return '\n---\n'+per_package_inst

    else:
        return ''