def METHOD_NAME(
    datetime, collection_shortname, version, sort_key, time_key
):
    """
    Validates the collection datetime against the datetime of the last granule in the collection
    Args:
        datetime (str): datetime string
        collection_shortname (str): ShortName of the parent collection
        sort_key (str): choice of start_date and end_date
        time_key (str): choice of time_end and time_start
    Returns:
        (dict) An object with the validity of the check and the instance
    """
    cmr_prms = set_cmr_prms(
        {
            "short_name": collection_shortname,
            "version": version,
            "sort_key[]": sort_key,
        },
        "json",
        "granules",
    )
    granules = cmr_request(cmr_prms)
    validity = True
    last_granule_datetime = None
    if len(granules["feed"]["entry"]) > 0:
        last_granule = granules["feed"]["entry"][0]
        last_granule_datetime = last_granule.get(time_key)
        validity = datetime == last_granule_datetime
    return {"valid": validity, "value": (datetime, last_granule_datetime)}