<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def populate(dataset_name, data_web_service_url=DATA_WEB_SERVICE + "CFHT"):
 """Given a dataset_name created the desired dbimages directories and links to the raw data files stored at CADC. @param dataset_name: the name of the CFHT dataset to make a link to. @param data_web_servica_url: the URL of the data web service run by CADC. """


    data_dest = get_uri(dataset_name, version='o', ext=FITS_EXT)
    data_source = "%s/%so.{}" % (data_web_service_url, dataset_name, FITS_EXT)

    mkdir(os.path.dirname(data_dest))

    try:
        client.link(data_source, data_dest)
    except IOError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise e

    header_dest = get_uri(dataset_name, version='o', ext='head')
    header_source = "%s/%so.fits.fz?cutout=[0]" % (
        data_web_service_url, dataset_name)
    try:
        client.link(header_source, header_dest)
    except IOError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise e

    header_dest = get_uri(dataset_name, version='p', ext='head')
    header_source = "%s/%s/%sp.head" % (
        'http://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/data/pub', 'CFHTSG', dataset_name)
    try:
        client.link(header_source, header_dest)
    except IOError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise e

    return True