Enables conversion from system arguments.

    Parameters
    ----------
    raw_args : list
        Arguments taken raw from the system input.

    Returns
    -------
    kwargs : dict
        The input arguments formatted as a kwargs dict.
        To use as input, simply use `KQMLModule(**kwargs)`.

def translate_argv(raw_args):
    """Enables conversion from system arguments.

    Parameters
    ----------
    raw_args : list
        Arguments taken raw from the system input.

    Returns
    -------
    kwargs : dict
        The input arguments formatted as a kwargs dict.
        To use as input, simply use `KQMLModule(**kwargs)`.
    """
    kwargs = {}

    def get_parameter(param_str):
        for i, a in enumerate(raw_args):
            if a == param_str:
                assert len(raw_args) == i+2 and raw_args[i+1][0] != '-', \
                    'All arguments must have a value, e.g. `-testing true`'
                return raw_args[i+1]
        return None

    value = get_parameter('-testing')
    if value is not None and value.lower() in ('true', 't', 'yes'):
            kwargs['testing'] = True

    value = get_parameter('-connect')
    if value is not None:
        colon = value.find(':')
        if colon > -1:
            kwargs['host'] = value[0:colon]
            kwargs['port'] = int(value[colon+1:])
        else:
            kwargs['host'] = value

    value = get_parameter('-name')
    if value is not None:
        kwargs['name'] = value

    value = get_parameter('-group')
    if value is not None:
        kwargs['group_name'] = value

    value = get_parameter('-scan')
    if value in ('true', 't', 'yes'):
        kwargs['scan_for_port'] = True

    value = get_parameter('-debug')
    if value in ('true', 't', 'yes'):
        kwargs['debug'] = True

    return kwargs