<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_sghead(expnum):
 """ Use the data web service to retrieve the stephen's astrometric header. :param expnum: CFHT exposure number you want the header for :rtype : list of astropy.io.fits.Header objects. """

    version = 'p'

    key = "{}{}".format(expnum, version)
    if key in sgheaders:
        return sgheaders[key]

    url = "http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub/CFHTSG/{}{}.head".format(expnum, version)
    logging.getLogger("requests").setLevel(logging.ERROR)
    logging.debug("Attempting to retrieve {}".format(url))
    resp = requests.get(url)
    if resp.status_code != 200:
        raise IOError(errno.ENOENT, "Could not get {}".format(url))

    header_str_list = re.split('END      \n', resp.content)

    # # make the first entry in the list a Null
    headers = [None]
    for header_str in header_str_list:
        headers.append(fits.Header.fromstring(header_str, sep='\n'))
        logging.debug(headers[-1].get('EXTVER', -1))
    sgheaders[key] = headers
    return sgheaders[key]