<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_2mass_epoch (tmra, tmdec, debug=False):
 """Given a 2MASS position, look up the epoch when it was observed. This function uses the CDS Vizier web service to look up information in the 2MASS point source database. Arguments are: tmra The source's J2000 right ascension, in radians. tmdec The source's J2000 declination, in radians. debug If True, the web server's response will be printed to :data:`sys.stdout`. The return value is an MJD. If the lookup fails, a message will be printed to :data:`sys.stderr` (unconditionally!) and the :data:`J2000` epoch will be returned. """

    import codecs
    try:
        from urllib.request import urlopen
    except ImportError:
        from urllib2 import urlopen
    postdata = b'''-mime=csv
-source=2MASS
-out=_q,JD
-c=%.6f %.6f
-c.eq=J2000''' % (tmra * R2D, tmdec * R2D)

    jd = None

    for line in codecs.getreader('utf-8')(urlopen (_vizurl, postdata)):
        line = line.strip ()
        if debug:
            print_ ('D: 2M >>', line)

        if line.startswith ('1;'):
            jd = float (line[2:])

    if jd is None:
        import sys
        print_ ('warning: 2MASS epoch lookup failed; astrometry could be very wrong!',
                file=sys.stderr)
        return J2000

    return jd - 2400000.5