'remove a key, value pair from a dict or an item for a list'

def pop(self, path, key_or_item):

    try:
        entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
    except KeyError:
        entry = None
    if (entry is None):
        return (False, self.yaml_dict)
    if isinstance(entry, dict):
        if (key_or_item in entry):
            entry.pop(key_or_item)
            return (True, self.yaml_dict)
        return (False, self.yaml_dict)
    elif isinstance(entry, list):
        ind = None
        try:
            ind = entry.index(key_or_item)
        except ValueError:
            return (False, self.yaml_dict)
        entry.pop(ind)
        return (True, self.yaml_dict)
    return (False, self.yaml_dict)
