<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_single(site, domain, delete_code=False, no_prompt=False):
 """ Delete a single site @type site: Site @type domain: Domain @type delete_code: bool @type no_prompt: bool """

    click.secho('Deleting installation "{sn}" hosted on the domain {dn}'.format(sn=site.name, dn=domain.name),
                fg='yellow', bold=True)
    if not no_prompt:
        if delete_code:
            warn_text = click.style('WARNING! THIS WILL PERMANENTLY DELETE THIS SITE AND ALL OF THE ASSOCIATED '
                                    'PROJECT CODE FILES!\nTHIS MEANS ALL DATA FILES, INCLUDING ANY CREATED CUSTOM '
                                    'APPLICATIONS AND PLUGINS WILL BE PERMANENTLY AND IRREVOCABLY ERASED!',
                                    fg='red', bold=True)
            click.echo(warn_text)
            prompt_text = click.style('In order to continue, please re-input the site name', fg='white', bold=True)
            prompt = click.prompt(prompt_text)

            # If our prompt doesn't match, abort
            if prompt != site.name:
                click.secho('Site name did not match, site will not be deleted. Aborting.', fg='red', bold=True)
                raise click.Abort('Site name prompt did not match')

        else:
            prompt_text = click.style('Are you sure you want to delete this site entry? Your project files will '
                                      'still be preserved.', fg='white', bold=True)
            click.confirm(prompt_text, abort=True)

    site.delete()

    if delete_code:
        _remove_code(site)

    # If this is the only site left in the domain, remove the domain now as well
    domain_sites = [ds for ds in domain.sites if ds.id != site.id]
    if not len(domain_sites):
        Session.delete(domain)

    Session.commit()
    click.secho('{sn} removed'.format(sn=site.name), fg='yellow', bold=True)

    # Restart Nginx
    FNULL = open(os.devnull, 'w')
    subprocess.check_call(['service', 'nginx', 'restart'], stdout=FNULL, stderr=subprocess.STDOUT)