def METHOD_NAME(options):
    opts = {}
    if 'url' not in options:
        raise Exception("URL needed")
    else:
        opts['url'] = options['url']
    if 'compression' in options:
        value = options['compression'].lower().strip()
        if value == 'true':
            opts['enableCompression'] = True
        elif value == 'false':
            opts['enableCompression'] = False
        else:
            raise Exception("invalid value '{0}' for compression".format(value))
    if 'autofrag' in options:
        try:
            value = int(options['autofrag'])
        except:
            raise Exception("invalid value '{0}' for autofrag".format(options['autofrag']))
        if value < 0:
            raise Exception("negative value '{0}' for autofrag".format(value))
        opts['autoFragmentSize'] = value
    if 'subprotocol' in options:
        value = options['subprotocol'].lower().strip()
        opts['subprotocol'] = value
    if 'debug' in options:
        value = options['debug'].lower().strip()
        if value == 'true':
            opts['debug'] = True
        elif value == 'false':
            opts['debug'] = False
        else:
            raise Exception("invalid value '{0}' for debug".format(value))
    return opts