def format_to_iso(date_string):
    """Formatting function to make sure the date string is in YYYY-MM-DDThh:mm:ssZ format.

    Args:
        date_string(str): a date string in ISO format could be like: YYYY-MM-DDThh:mm:ss+00:00 or: YYYY-MM-DDThh:mm:ss

    Returns:
        str. A date string in the format: YYYY-MM-DDThh:mm:ssZ
    """
    if len(date_string) > 19 and not date_string.endswith('Z'):
        date_string = date_string[:-6]

    if not date_string.endswith('Z'):
        date_string = date_string + 'Z'

    return date_string