<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_sources_from_file(file_name, update=True):
 """ Add source urls from a file list. The file should contain the source line to add followed by the key url, if any, enclosed in parentheses. Ex: deb http://example.com/deb lucid main (http://example.com/key) """


    key_regex = re.compile(r'(?P<source>[^()]*)(\s+\((?P<key>.*)\))?$')
    for line in _read_lines_from_file(file_name):
        kwargs = key_regex.match(line).groupdict()
        kwargs['update'] = False
        add_apt_source(**kwargs)
    if update:
        update_apt_sources()