<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_apt_source(source, key=None, update=True):
 """Adds source url to apt sources.list. Optional to pass the key url."""


    # Make a backup of list
    source_list = u'/etc/apt/sources.list'
    sudo("cp %s{,.bak}" % source_list)
    files.append(source_list, source, use_sudo=True)
    if key:
        # Fecth key from url and add
        sudo(u"wget -q %s -O - | sudo apt-key add -" % key)
    if update:
        update_apt_sources()