def METHOD_NAME(filename, time, api_key):
    """Retrieve a png image of rainfall from the DataPoint service.
    Args:
        filename (str): The path to write the image file to.
        time (str): The datetime of the image to retrieve in ISO8601 format.
        api_key (str): Datapoint API key.
    """
    time = datetime.strptime(time, '%Y%m%dT%H%MZ').strftime(
        '%Y-%m-%dT%H:%M:%SZ')
    url = URL.format(time=time, api_key=api_key)
    req = requests.get(url)
    if req.status_code != 200:
        raise Exception(f'{url} returned exit code {req.status_code}')
    with open(filename, 'bw') as png_file:
        png_file.write(req.content)