def _parse_query_arguments(query_arguments):
    """ This function converts a string in the format 'key1:value1-key2:value2' to a dict in the
    format {'key1': 'value1', 'key2': 'value2',...}.

    Args:
        query_arguments: A string cuntianing all the arguments to query by
        e.g. 'tags:cat,plastic-tag_mode:any'.

    Returns:
        A dict of all the args e.g.  {'tags': 'cat,plastic', 'tag_mode': 'any', 'text':''}.
    """
    init_query_arguments = {'tags': 'all', 'tag_mode': 'any', 'text': ''}
    if query_arguments is not None:
        different_arg = query_arguments.split('-')
        for arg in different_arg:
            key = arg.split(':')[0]
            value = arg.split(':')[1]
            if key in init_query_arguments:
                if key == 'tag_mode' and value != 'any' and value != 'all':
                    raise ValueError('Invalid tag_mode, tag_mode can be "any" or "all"')
                init_query_arguments[key] = value
            else:
                raise ValueError('Invalid query_arguments key can be tags, tag_mode or text.')
    return init_query_arguments