from datetime import datetime


def parse_iso8601(string):
    """
    Parses a string such as 2020-01-15T12:29:59.432228Z
    and returns a matching datetime object.

    """

    return datetime.strptime(string, "%Y-%m-%dT%H:%M:%S.%fZ")