def parse_name(name_str):
    """
    Tries to get name and surname from data written on a grave.
    Mainly tries to remove nicknames and keeps only one name and surname.
    """
    try:
        name, *_, surname = name_str.strip().split()
    except:
        return None, None

    name = name.title()
    surname = surname.title()
    if '<i>' in name.lower():
        name = None
    return name, surname