def get_deep(obj, selector):
    """ Returns the object given by the selector, eg a:b:c:1 for ['a']['b']['c'][1] """
    try:
        if type(selector) is str:
            selector = selector.split(':')

        if len(selector) == 0:
            return obj

        top_selector = selector.pop(0)

        if type(obj) is list:
            top_selector = int(top_selector)
            return get_deep(obj[top_selector], selector)

        if type(obj) is dict:
            return get_deep(obj[top_selector], selector)

        if obj is None:
            raise KeyError()
    except:
        raise KeyError(str(selector))