Looks for the OkPy-generated string:

    "Successfully logged in as <email>"

    and returns the email address.

    Raises a ValueError if email not found.

def find_student_email(nb) -> str:
    '''
    Looks for the OkPy-generated string:

    "Successfully logged in as <email>"

    and returns the email address.

    Raises a ValueError if email not found.
    '''
    search = 'Successfully logged in as '

    cells = [cell for cell in nb.cells if 'outputs' in cell]
    for cell in cells:
        for output in cell.outputs:
            if 'text' in output and search in output.text:
                return output.text.split(search)[1].strip()
    raise ValueError('Error: was not able to get email from ok.auth() cell.'
                     'Please run that cell and try again.')