<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_start_end_nans(data):
 """ Find NaN values in data that either start or end the time-series Function to return a binary array of same size as data where `True` values correspond to NaN values present at beginning or end of time-series. NaNs internal to the time-series are not included in the binary mask. :param data: Array of observations of size TxNOBS :type data: numpy.array :return: Binary array of shape TxNOBS. `True` values indicate NaNs present at beginning or end of time-series :rtype: numpy.array """

        # find NaNs that start a time-series
        start_nan = np.isnan(data)
        for idx, row in enumerate(start_nan[:-1]):
            start_nan[idx + 1] = np.logical_and(row, start_nan[idx + 1])
        # find NaNs that end a time-series
        end_nan = np.isnan(data)
        for idx, row in enumerate(end_nan[-2::-1]):
            end_nan[-idx-2] = np.logical_and(row, end_nan[-idx-1])

        return np.logical_or(start_nan, end_nan)