import json


def remove_snipe(user_id, index):
    """Removes the specified snipe from the json"""

    # Load in the current snipes
    with open("apidata/snipes.json", "r") as f:
        snipes_dict = json.load(f)

    # If the snipe exists, remove it, update json, and return true
    # Else, return false
    if user_id in snipes_dict.keys():
        if index in snipes_dict[user_id]:
            snipes_dict[user_id].remove(index)
            with open("apidata/snipes.json", "w") as f:
                json.dump(snipes_dict, f)
            return True
        else:
            return False
    else:
        return False