def get_period_overlap(request_start, request_end, avail_start, avail_end):
    """Finds period of overlap between the requested time range and the
    available period.

    Parameters
    ----------
    request_start: datetime-like
        Start of the period of requested data.
    request_end: datetime-like
        End of the period of requested data.
    avail_start: datetime-like
        Start of the available data.
    avail_end: datatime-like
        End of available data.

    Returns
    -------
    start, end: list of datetime or None
        Start and end of overlapping period, or None if no overlap occurred.
    """
    if request_start < avail_end and request_end > avail_start:
        if request_start < avail_start:
            start = avail_start
        else:
            start = request_start
        if request_end > avail_end:
            end = avail_end
        else:
            end = request_end
        return [start, end]
    else:
        return None