def METHOD_NAME(url: str, goal: int, area_codes: list, max_retries: int, bytes_read: int = 0) -> bytes:
    """Downloads a file from a url.
    Retries download up to {max_retries} times following a ChunkedEncodingError
    exception.
    """
    log.info(
        f"Downloading data...",
        url=url,
        bytes_read=bytes_read,
        remaining_retries=max_retries,
        goal=goal,
    )
    if bytes_read:
        headers = {"Range": f"bytes={bytes_read}-"}
    else:
        headers = {}
    content = b""
    try:
        with requests.post(
            url,
            data={"goal": goal, "areaCodes": area_codes},
            headers=headers,
            stream=True,
        ) as r:
            r.raise_for_status()
            for chunk in r.iter_content(chunk_size=CHUNK_SIZE):
                bytes_read += CHUNK_SIZE
                content += chunk
    except requests.exceptions.ChunkedEncodingError:
        if max_retries > 0:
            log.info("Encountered ChunkedEncodingError, resuming download...")
            content += METHOD_NAME(
                url=url,
                goal=goal,
                area_codes=area_codes,
                max_retries=max_retries - 1,
                bytes_read=bytes_read,
            )
        else:
            log.error(
                "Encountered ChunkedEncodingError, but max_retries has been "
                "exceeded. Download may not have been fully completed."
            )
    return content