def argv_to_dict(argv):
    """Turns parameters in the form of '--key value' into a dict {'key': 'value'}
    """
    cli_dict = {}
    for i in range(len(argv)):
        if argv[i][0] == '-':
            key = argv[i].strip('-')
            value = argv[i + 1] if len(argv) > i + 1 else None
            if not value or value[0] == '-':
                cli_dict[key] = True
            else:
                cli_dict[key] = value
    return cli_dict
