docs: def _fit_star(self, epsf, star, fitter, fitter_kwargs,
                    fitter_has_fit_info, fit_boxsize):
          """
          Fit an ePSF model to a single star.
  
          The input ``epsf`` will usually be modified by the fitting
          routine in this function.  Make a copy before calling this
          function if the original is needed.
          """
  
          if fit_boxsize is not None:
              try:
                  xcenter, ycenter = star.cutout_center
                  large_slc, small_slc = overlap_slices(star.shape,
                                                        fit_boxsize,
                                                        (ycenter, xcenter),
                                                        mode='strict')
              except (PartialOverlapError, NoOverlapError):
                  warnings.warn('The star at ({0}, {1}) cannot be fit because '
                                'its fitting region extends beyond the star '
                                'cutout image.'.format(star.center[0],
                                                       star.center[1]),
                                AstropyUserWarning)
  
                  star = copy.deepcopy(star)
                  star._fit_error_status = 1
  
                  return star
  
              data = star.data[large_slc]
              weights = star.weights[large_slc]
  
              # define the origin of the fitting region
              x0 = large_slc[1].start
              y0 = large_slc[0].start
          else:
              # use the entire cutout image
              data = star.data
              weights = star.weights
  
              # define the origin of the fitting region
              x0 = 0
              y0 = 0
  
          scaled_data = data / np.prod(epsf._oversampling)
  
          # define positions in the ePSF oversampled grid
          yy, xx = np.indices(data.shape, dtype=np.float)
          xx = (xx - (star.cutout_center[0] - x0)) * epsf._oversampling[0]
          yy = (yy - (star.cutout_center[1] - y0)) * epsf._oversampling[1]
  
          # define the initial guesses for fitted flux and shifts
          epsf.flux = star.flux
          epsf.x_0 = 0.0
          epsf.y_0 = 0.0
  
          # create copy to avoid overwriting original oversampling factor
          _epsf = epsf.copy()
          _epsf._oversampling = np.array([1., 1.])
  
          try:
              fitted_epsf = fitter(model=_epsf, x=xx, y=yy, z=scaled_data,
                                   weights=weights, **fitter_kwargs)
          except TypeError:
              # fitter doesn't support weights
              fitted_epsf = fitter(model=_epsf, x=xx, y=yy, z=scaled_data,
                                   **fitter_kwargs)
  
          fit_error_status = 0
          if fitter_has_fit_info:
              fit_info = copy.copy(fitter.fit_info)
  
              if 'ierr' in fit_info and fit_info['ierr'] not in [1, 2, 3, 4]:
                  fit_error_status = 2    # fit solution was not found
          else:
              fit_info = None
  
          # compute the star's fitted position
          x_center = (star.cutout_center[0] +
                      (fitted_epsf.x_0.value / epsf._oversampling[0]))
          y_center = (star.cutout_center[1] +
                      (fitted_epsf.y_0.value / epsf._oversampling[1]))
  
          star = copy.deepcopy(star)
          star.cutout_center = (x_center, y_center)
  
          # set the star's flux to the ePSF-fitted flux
          star.flux = fitted_epsf.flux.value
  
          star._fit_info = fit_info
          star._fit_error_status = fit_error_status
  
          return star