def parse_cmd(cmd):
    """
    Split the cmd string. Delimiters are: space, simple and double quotes
    """
    SINGLE_QUOTE = "'"
    DOUBLE_QUOTE = "\""
    ESPACE = " "
    result = []
    cache = ""
    quote_context = None
    collect_cache = False
    for char in cmd:
        if quote_context is None:  # outside a quote context
            if char in (SINGLE_QUOTE, DOUBLE_QUOTE):
                quote_context = char
                collect_cache = True
            elif char == ESPACE:
                collect_cache = True
            else:
                cache += char
        else:  # inside a quote context
            if char == quote_context:
                quote_context = None
                collect_cache = True
            else:
                cache += char
        # cache collection
        if collect_cache:
            collect_cache = False
            if cache:
                result.append(cache)
            cache = ""
    if cache:
        result.append(cache)
    return result