def get_moon_j2000(epoch, line1, line2, position=None):
    '\n    \n    Code to determine the apparent J2000 position for a given\n    time and at a given position for the observatory.\n    \n    epoch needs to be a datetime or Time object.\n    \n    position is a list/tuple of X/Y/Z positions\n    \n    '
    from astropy.time import Time
    from astropy.coordinates import get_moon, EarthLocation
    import astropy.units as u
    import sys
    from datetime import datetime
    if (type(epoch) is Time):
        epoch = epoch.datetime
    if (position is None):
        position = get_nustar_location(epoch, line1, line2)
    t = Time(epoch)
    loc = eci2el(*(position * u.km), t)
    moon_coords = get_moon(t, loc)
    (ra_moon, dec_moon) = ((moon_coords.ra.degree * u.deg), (moon_coords.dec.degree * u.deg))
    return (ra_moon, dec_moon)
Code to determine the apparent J2000 position for a given
time and at a given position for the observatory.

epoch needs to be a datetime or Time object.

position is a list/tuple of X/Y/Z positions
def get_moon_j2000(epoch, line1, line2, position=None):
    '\n    \n    Code to determine the apparent J2000 position for a given\n    time and at a given position for the observatory.\n    \n    epoch needs to be a datetime or Time object.\n    \n    position is a list/tuple of X/Y/Z positions\n    \n    '
    from astropy.time import Time
    from astropy.coordinates import get_moon, EarthLocation
    import astropy.units as u
    import sys
    from datetime import datetime
    if (type(epoch) is Time):
        epoch = epoch.datetime
    if (position is None):
        position = get_nustar_location(epoch, line1, line2)
    t = Time(epoch)
    loc = eci2el(*(position * u.km), t)
    moon_coords = get_moon(t, loc)
    (ra_moon, dec_moon) = ((moon_coords.ra.degree * u.deg), (moon_coords.dec.degree * u.deg))
    return (ra_moon, dec_moon)