<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def from_soup_tag(tag):
        "Returns a new Period instance from the given beautifulsoup tag."
        days = []
        for elem in tag.findAll(recursive=False):
            if elem.name != 'day':
                raise TypeError("Unknown tag found: " + str(elem))
            days.append(elem.string)
        return Period(
            tag['type'], tag['instructor'], tag['start'], tag['end'],
            tag['location'], days
        )