<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_package_template(license, header=False):
 """ Load license template distributed with package. """

    content = StringIO()
    filename = 'template-%s-header.txt' if header else 'template-%s.txt'
    with resource_stream(__name__, filename % license) as licfile:
        for line in licfile:
            content.write(line.decode("utf-8"))  # write utf-8 string
    return content