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

def selfoss(reset_password=False):
    '''Install, update and set up selfoss.

    This selfoss installation uses sqlite (selfoss-default), php5-fpm and nginx.

    The connection is https-only and secured by a letsencrypt certificate.  This
    certificate must be created separately with task setup.server_letsencrypt.

    More infos:
      https://selfoss.aditu.de/
      https://github.com/SSilence/selfoss/wiki
      https://www.heise.de/ct/ausgabe/2016-13-RSS-Reader-Selfoss-hat-die-Nachrichtenlage-im-Blick-3228045.html
      https://ct.de/yqp7
    '''
    hostname = re.sub(r'^[^@]+@', '', env.host)  # without username if any
    sitename = query_input(
                   question='\nEnter site-name of Your trac web service',
                   default=flo('selfoss.{hostname}'))
    username = env.user

    site_dir = flo('/home/{username}/sites/{sitename}')

    checkout_latest_release_of_selfoss()
    create_directory_structure(site_dir)

    restored = install_selfoss(sitename, site_dir, username)

    nginx_site_config(username, sitename, hostname)
    enable_php5_socket_file()

    if not restored or reset_password:
        setup_selfoss_user(username, sitename, site_dir)

    print_msg('\n## reload nginx and restart php\n')
    run('sudo service nginx reload')
    run('sudo service php5-fpm restart')