def comma_formatter(name_list: list) -> str:
    """Return a properly formatted strings from a list

    Args:
        name_list (list): list of dog names

    Returns:
        str: a string in the form of name1, name2, and name3
    """
    if len(name_list) == 2:
        return " and ".join(name_list)
    else:
        return ", ".join(name_list[:-2] + [", and ".join(name_list[-2:])])