import re
import logging


def extract_name(resume_segments):
    """
       Find name in the string_to_search
       :param resume_segments: Dictionary containing segmented resume data
       :type resume_segments: Dictionary
       :return: A string containing the name, or None if no name is found.
       :rtype: str
    """
    try:
        string_to_search = resume_segments['contact_info']
        name_pattern = re.compile(r"^([A-Za-z\u00E9-\u00F8\.-][\s]*)+$")
        name = ''
        for line in string_to_search:
            if name_pattern.match(line):
                name = line
                break

        return name

    except Exception as e:
        logging.error('Issue parsing name:: ' + str(e))
        return None