<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_canonical(version, loosedev=False):
 # type: (str, bool) -> bool """ Return whether or not the version string is canonical according to Pep 440 """

    if loosedev:
        return loose440re.match(version) is not None
    return pep440re.match(version) is not None