code: def month_indices(months):
      
      if not isinstance(months, (int, str)):
          raise TypeError("`months` must be of type int or str: "
                          "type(months) == {}".format(type(months)))
      if isinstance(months, int):
          return [months]
      if months.lower() == 'ann':
          return np.arange(1, 13)
      first_letter = 'jfmamjjasond' * 2
      # Python indexing starts at 0; month indices start at 1 for January.
      count = first_letter.count(months)
      if (count == 0) or (count > 2):
          message = ("The user must provide a unique pattern of consecutive "
                     "first letters of months within '{}'. The provided "
                     "string '{}' does not comply."
                     "  For individual months use integers."
                     "".format(first_letter, months))
          raise ValueError(message)
      st_ind = first_letter.find(months.lower())
      return np.arange(st_ind, st_ind + len(months)) % 12 + 1
docs: Convert string labels for months to integer indices.
  
      Parameters
      ----------
       months : str, int
           If int, number of the desired month, where January=1, February=2,
           etc.  If str, must match either 'ann' or some subset of
           'jfmamjjasond'.  If 'ann', use all months.  Otherwise, use the
           specified months.
  
      Returns
      -------
      np.ndarray of integers corresponding to desired month indices
  
      Raises
      ------
      TypeError : If `months` is not an int or str
  
      See also
      --------
      _month_conditional