<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def fetch(url, fullpath):
    '''
    Fetch data from an URL and save it under the given target name.
    '''
    logger.debug("Fetching %s from %s" % (fullpath, url))

    try:
        tmpfile, headers = urlretrieve(url)
        if os.path.exists(fullpath):
            os.remove(fullpath)
        shutil.move(tmpfile, fullpath)
    except Exception as e:
        logger.error("Error during fetching: " + str(e))
        raise