def extract_var_key(raw_line: str, var_id: str) -> str:
    """
    Extract the key from an line in the form "dict['key']" or
    "dict.get('key', *args)".
    """
    line = raw_line.strip()[len(var_id) :]
    state_var = ""
    if line[0] == "[":
        state_var = line[2:-2]
    elif line[0:4] == ".get":
        call = line.split("(")[1]
        call = call.split(")")[0]
        call = call.strip()
        sep = "'"
        if call[0] == '"':
            sep = '"'
        state_var = [el for el in call.split(sep) if len(el) > 0][0]
    return state_var