docs: def determine_start_end_timestep(lsm_file_list,
                                   file_re_match=None,
                                   file_datetime_pattern=None,
                                   expected_time_step=None,
                                   lsm_grid_info=None):
      """
      Determine the start and end date from LSM input files
      """
      if lsm_grid_info is None:
          lsm_grid_info = identify_lsm_grid(lsm_file_list[0])
  
      if None in (lsm_grid_info['time_var'], lsm_grid_info['time_dim'])\
              or lsm_grid_info['model_name'] in ('era_20cm', 'erai'):
          # NOTE: the ERA20CM and ERA 24hr time variables
          # in the tests are erroneous
          if None in (file_re_match, file_datetime_pattern):
              raise ValueError("LSM files missing time dimension and/or "
                               "variable.To mitigate this, add the "
                               "'file_re_match' and 'file_datetime_pattern' "
                               "arguments.")
  
          if lsm_grid_info['time_dim'] is None:
              print("Assuming time dimension is 1")
              file_size_time = 1
          else:
              lsm_example_file = Dataset(lsm_file_list[0])
              file_size_time = \
                  len(lsm_example_file.dimensions[lsm_grid_info['time_dim']])
              lsm_example_file.close()
  
          total_num_time_steps = int(file_size_time * len(lsm_file_list))
  
          # determine the start time from the existing files
          actual_simulation_start_datetime = \
              datetime.strptime(file_re_match.search(lsm_file_list[0]).group(0),
                                file_datetime_pattern)
  
          # check to see if the time step matches expected
          if len(lsm_file_list) > 1:
              time_step = \
                  int((datetime.strptime(
                      file_re_match.search(lsm_file_list[1]).group(0),
                      file_datetime_pattern) -
                      actual_simulation_start_datetime).total_seconds()
                      / float(file_size_time))
  
          elif expected_time_step is not None:
              time_step = int(expected_time_step)
          else:
              raise ValueError("Only one LSM file with one timestep present. "
                               "'expected_time_step' parameter required to "
                               "continue.")
  
          # determine the end datetime
          actual_simulation_end_datetime = \
              datetime.strptime(file_re_match.search(lsm_file_list[-1]).group(0),
                                file_datetime_pattern) \
              + timedelta(seconds=(file_size_time-1) * time_step)
      else:
          with pangaea.open_mfdataset(lsm_file_list,
                                      lat_var=lsm_grid_info['latitude_var'],
                                      lon_var=lsm_grid_info['longitude_var'],
                                      time_var=lsm_grid_info['time_var'],
                                      lat_dim=lsm_grid_info['latitude_dim'],
                                      lon_dim=lsm_grid_info['longitude_dim'],
                                      time_dim=lsm_grid_info['time_dim']) as xds:
  
              datetime_arr = [pd.to_datetime(dval) for dval in
                              xds.lsm.datetime.values]
              actual_simulation_start_datetime = datetime_arr[0]
              actual_simulation_end_datetime = datetime_arr[-1]
              total_num_time_steps = len(datetime_arr)
  
              if total_num_time_steps <= 1:
                  if expected_time_step is not None:
                      time_step = int(expected_time_step)
                  else:
                      raise ValueError("Only one LSM file with one timestep "
                                       "present. 'expected_time_step' parameter "
                                       "required to continue.")
              else:
                  time_step = int(np.diff(xds.lsm.datetime.values)[0]
                                  / np.timedelta64(1, 's'))
  
      if expected_time_step is not None:
          if time_step != int(expected_time_step):
              print("WARNING: The time step used {0} is different than "
                    "expected {1}".format(time_step, expected_time_step))
  
      return (actual_simulation_start_datetime, actual_simulation_end_datetime,
              time_step, total_num_time_steps)