def encode_task(task_tuple):
    """ Encodes a syllogistic task by transforming a task tuple string into
    its corresponding identifier.

    Parameters
    ----------
    task_tuple : list(list(str))
        Task tuple in list representation (e.g.,
        [['Some', 'models', 'managers'], ['All', 'models', 'clerks']])

    Returns
    -------
    str
        Syllogistic task identifier (e.g., 'AI1'). Figures are defined in
        accordance to Khemlani et al. (2012).

    """
    prem_1, prem_2 = task_tuple
    quant1 = prem_1[0].replace('All', 'A').replace('Some not', 'O').replace(
        'Some', 'I').replace('No', 'E')
    quant2 = prem_2[0].replace('All', 'A').replace('Some not', 'O').replace(
        'Some', 'I').replace('No', 'E')
    figure = 1
    if prem_1[1] == prem_2[1]:
        figure = 4
    elif prem_1[2] == prem_2[1]:
        figure = 1
    elif prem_1[2] == prem_2[2]:
        figure = 3
    elif prem_1[1] == prem_2[2]:
        figure = 2
    else:
        raise ValueError('Could not determine figure of:', task_tuple)
    return quant1 + quant2 + str(figure)
