<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def expand(self, a=None, f=None, lmax=None, lmax_calc=None, normal_gravity=True, sampling=2):
 """ Create 2D cylindrical maps on a flattened and rotating ellipsoid of all three components of the gravity field, the gravity disturbance, and the gravitational potential, and return as a SHGravGrid class instance. Usage ----- grav = x.expand([a, f, lmax, lmax_calc, normal_gravity, sampling]) Returns ------- grav : SHGravGrid class instance. Parameters a : optional, float, default = self.r0 The semi-major axis of the flattened ellipsoid on which the field is computed. f : optional, float, default = 0 The flattening of the reference ellipsoid: f=(a-b)/a. lmax : optional, integer, default = self.lmax The maximum spherical harmonic degree, which determines the number of samples of the output grids, n=2lmax+2, and the latitudinal sampling interval, 90/(lmax+1). lmax_calc : optional, integer, default = lmax The maximum spherical harmonic degree used in evaluating the functions. This must be less than or equal to lmax. normal_gravity : optional, bool, default = True If True, the normal gravity (the gravitational acceleration on the ellipsoid) will be subtracted from the total gravity, yielding the "gravity disturbance." This is done using Somigliana's formula (after converting geocentric to geodetic coordinates). sampling : optional, integer, default = 2 If 1 the output grids are equally sampled (n by n). If 2 (default), the grids are equally spaced in degrees (n by 2n). Description This method will create 2-dimensional cylindrical maps of the three components of the gravity field, the total field, and the gravitational potential, and return these as an SHGravGrid class instance. Each map is stored as an SHGrid class instance using Driscoll and Healy grids that are either equally sampled (n by n) or equally spaced (n by 2n) in latitude and longitude. All grids use geocentric coordinates, the output is in SI units, and the sign of the radial components is positive when directed upwards. If the optional angular rotation rate omega is specified in the SHGravCoeffs instance, the potential and radial gravitational acceleration will be calculated in a body-fixed rotating reference frame. If normal_gravity is set to True, the normal gravity will be removed from the total field, yielding the gravity disturbance. The gravitational potential is given by V = GM/r Sum_{l=0}^lmax (r0/r)^l Sum_{m=-l}^l C_{lm} Y_{lm}, and the gravitational acceleration is B = Grad V. The coefficients are referenced to the radius r0, and the function is computed on a flattened ellipsoid with semi-major axis a (i.e., the mean equatorial radius) and flattening f. To convert m/s^2 to mGals, multiply the gravity grids by 10^5. """

        if a is None:
            a = self.r0
        if f is None:
            f = 0.
        if normal_gravity is True:
            ng = 1
        else:
            ng = 0
        if lmax is None:
            lmax = self.lmax
        if lmax_calc is None:
            lmax_calc = lmax

        if self.errors is not None:
            coeffs, errors = self.to_array(normalization='4pi', csphase=1)
        else:
            coeffs = self.to_array(normalization='4pi', csphase=1)

        rad, theta, phi, total, pot = _MakeGravGridDH(
            coeffs, self.gm, self.r0, a=a, f=f, lmax=lmax,
            lmax_calc=lmax_calc, sampling=sampling, omega=self.omega,
            normal_gravity=ng)

        return _SHGravGrid(rad, theta, phi, total, pot, self.gm, a, f,
                           self.omega, normal_gravity, lmax, lmax_calc)