import string


def get_last_name(collected_by):
    """Extract the last name from the collected by field."""
    if not collected_by:
        return ''

    collected_by = collected_by.split(',')
    if not collected_by or not collected_by[0]:
        return ''

    last_name = collected_by[0]

    while (last_name[-1] in string.punctuation
           or (len(last_name) > 4 and last_name[-2] == ' ')):
        if last_name[-1] in string.punctuation:
            last_name = last_name[:-1]
        if len(last_name) > 4 and last_name[-2] == ' ':
            last_name = last_name[:-2]

    return last_name