import re


def handle_lambda(call, line, file):
    """
    Resolve calls that point to <lambda>. Finds the lambda definition in the file/line
    pointed to by the `call` and extracts the name of the variable that gets assigned
    the lambda.

    :param call: call dictionary
    :param line: line dictionary
    :param file: file dictionary of the file pointed to by the call

    :return: updated call dictionary
    """

    if call['entry_point'] == '<lambda>':
        if line['line_number'] == call['line_number']:
            return {}

        num = call['line_number']
        # file the name of the variable defined in file['lines'][num-1]
        m = re.search(r'(?<=\s)(\w*)(?=\s*=\s*lambda)', file['lines'][num-1]['code'])
        if m is not None:
            call['entry_point'] = m.group(0)

    return call