'Create a download configuration based on some given parameters. Possible parameters are:
- anon_hops: the number of hops for the anonymous download. 0 hops is equivalent to a plain download
- safe_seeding: whether the seeding of the download should be anonymous or not (0 = off, 1 = on)
- destination: the destination path of the torrent (where it is saved on disk)'

@staticmethod
def create_dconfig_from_params(parameters):

    download_config = DownloadStartupConfig()
    anon_hops = 0
    if (('anon_hops' in parameters) and (len(parameters['anon_hops']) > 0)):
        if parameters['anon_hops'][0].isdigit():
            anon_hops = int(parameters['anon_hops'][0])
    safe_seeding = False
    if (('safe_seeding' in parameters) and (len(parameters['safe_seeding']) > 0) and (parameters['safe_seeding'][0] == '1')):
        safe_seeding = True
    if ((anon_hops > 0) and (not safe_seeding)):
        return (None, 'Cannot    set    anonymous    download    without    safe    seeding    enabled')
    if (anon_hops > 0):
        download_config.set_hops(anon_hops)
    if safe_seeding:
        download_config.set_safe_seeding(True)
    if (('destination' in parameters) and (len(parameters['destination']) > 0)):
        dest_dir = unicode(parameters['destination'][0], 'utf-8')
        download_config.set_dest_dir(dest_dir)
    if ('selected_files[]' in parameters):
        selected_files_list = [unicode(f, 'utf-8') for f in parameters['selected_files[]']]
        download_config.set_selected_files(selected_files_list)
    return (download_config, None)
