import re


def clean_path(dirty):
    """Convert a string of python subscript notation or mongo dot-notation to a
        list of strings.
        """
    # handle python dictionary subscription style, e.g. `"['key1']['key2']"`:
    if re.match(r'^\[', dirty):
        return re.split(r'\'\]\[\'', re.sub(r'^\[\'|\'\]$', '', dirty))
    # handle mongo op dot-notation style, e.g. `"key1.key2"`:
    return dirty.split('.')