<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def download_to_file(url, filepath, resume=False, overwrite=False, chunk_size=1024 * 1024 * 10, loadbar_length=10):
 """Download a url. prints a simple loading bar [=*loadbar_length] to show progress (in console and notebook) :type url: str :type filepath: str :param filepath: path to download to :param resume: if True resume download from existing file chunk :param overwrite: if True remove any existing filepath :param chunk_size: None or int in bytes :param loadbar_length: int length of load bar :return: """

    resume_header = None
    loaded_size = 0
    write_mode = 'wb'

    if os.path.exists(filepath):
        if overwrite:
            os.remove(filepath)
        elif resume:
            # if we want to resume, first try and see if the file is already complete
            loaded_size = os.path.getsize(filepath)
            clength = requests.head(url).headers.get('content-length')
            if clength is not None:
                if int(clength) == loaded_size:
                    return None
            # give the point to resume at
            resume_header = {'Range': 'bytes=%s-' % loaded_size}
            write_mode = 'ab'
        else:
            return None

    stream = False if chunk_size is None else True

    # start printing with no return character, so that we can have everything on one line
    print("Downloading {0:s}: ".format(url), end="")

    response = requests.get(url, stream=stream, headers=resume_header)
    # raise error if download was unsuccessful
    response.raise_for_status()

    # get the size of the file if available
    total_length = response.headers.get('content-length')
    if total_length is not None:
        total_length = float(total_length) + loaded_size
        print("{0:.2f}Mb/{1:} ".format(total_length / (1024 * 1024), loadbar_length), end="")
    print("[", end="")

    parent = os.path.dirname(filepath)
    if not os.path.exists(parent) and parent:
        os.makedirs(parent)

    with io.open(filepath, write_mode) as f:
        loaded = 0
        for chunk in response.iter_content(chunk_size=chunk_size):
            if chunk:  # filter out keep-alive new chunks
                # print our progress bar
                if total_length is not None and chunk_size is not None:
                    while loaded < loadbar_length * loaded_size / total_length:
                        print("=", end='')
                        loaded += 1
                    loaded_size += chunk_size
                f.write(chunk)
        if total_length is None:
            print("=" * loadbar_length, end='')
        else:
            while loaded < loadbar_length:
                print("=", end='')
                loaded += 1
    print("] Finished")