<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_locale_prefixdata_file(prefixdata, filename, locale=None, overall_prefix=None, separator=None):
 """Load per-prefix data from the given file, for the given locale and prefix. We assume that this file: - is encoded in UTF-8 - may have comment lines (starting with #) and blank lines - has data lines of the form '<prefix>|<stringdata>' - contains only data for prefixes that are extensions of the filename. If overall_prefix is specified, lines are checked to ensure their prefix falls within this value. If locale is specified, prefixdata[prefix][locale] is filled in; otherwise, just prefixdata[prefix]. If separator is specified, the string data will be split on this separator, and the output values in the dict will be tuples of strings rather than strings. """

    with open(filename, "rb") as infile:
        lineno = 0
        for line in infile:
            uline = line.decode('utf-8')
            lineno += 1
            dm = DATA_LINE_RE.match(uline)
            if dm:
                prefix = dm.group('prefix')
                stringdata = dm.group('stringdata')
                if stringdata != stringdata.rstrip():
                    print ("%s:%d: Warning: stripping trailing whitespace" % (filename, lineno))
                    stringdata = stringdata.rstrip()
                if overall_prefix is not None and not prefix.startswith(overall_prefix):
                    raise Exception("%s:%d: Prefix %s is not within %s" %
                                    (filename, lineno, prefix, overall_prefix))
                if separator is not None:
                    stringdata = tuple(stringdata.split(separator))
                if prefix not in prefixdata:
                    prefixdata[prefix] = {}
                if locale is not None:
                    prefixdata[prefix][locale] = stringdata
                else:
                    prefixdata[prefix] = stringdata
            elif BLANK_LINE_RE.match(uline):
                pass
            elif COMMENT_LINE_RE.match(uline):
                pass
            else:
                raise Exception("%s:%d: Unexpected line format: %s" %
                                (filename, lineno, line))