def flatten_arguments(arg_dict):
    """Flattens a dict of arguments into a list for subprocess."""
    args = []
    for arg_name, arg_value in sorted(arg_dict.items()):
        if isinstance(arg_value, bool):
            args += [arg_name]
        elif hasattr(arg_value, '__iter__') and not isinstance(arg_value, str):
            args += [arg_name] + list(arg_value)
        else:
            args += [arg_name, str(arg_value)]
    return args
