<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pyephem_earthsun_distance(time):
 """ Calculates the distance from the earth to the sun using pyephem. Parameters time : pd.DatetimeIndex Returns ------- pd.Series. Earth-sun distance in AU. """


    import ephem

    sun = ephem.Sun()
    earthsun = []
    for thetime in time:
        sun.compute(ephem.Date(thetime))
        earthsun.append(sun.earth_distance)

    return pd.Series(earthsun, index=time)