original_docstring: 
          Download a file - optionally with a filename
          :param url: URL to be requested
          :param filename: optional filename
          :return: output filename
          
docstring: Download a file - optionally with a filename
docstring_tokens: Download a file - optionally with a filename
code: def download_image(url,USER,PASS, filename=None):
          DIGEST = HTTPDigestAuth(username=USER, password=PASS)
          """
          Download a file - optionally with a filename
          :param url: URL to be requested
          :param filename: optional filename
          :return: output filename
          """
          # take filename if provided
          if filename:
              local_filename = filename
          else:
              local_filename = url.split('/')[-1]
  
          # NOTE the stream=True parameter
          r = requests.get(url, auth=DIGEST, stream=True)
          with open(local_filename, 'wb') as f:
              for chunk in r.iter_content(chunk_size=1024):
                  if chunk: # filter out keep-alive new chunks
                      f.write(chunk)
          return local_filename
code_tokens: def download_image ( url , USER , PASS , filename = None ) : DIGEST = HTTPDigestAuth ( username = USER , password = PASS ) if filename : local_filename = filename else : local_filename = url . split ( '/' ) [ - 1 ] r = requests . get ( url , auth = DIGEST , stream = True ) with open ( local_filename , 'wb' ) as f : for chunk in r . iter_content ( chunk_size = 1024 ) : if chunk : f . write ( chunk ) return local_filename
short_docstring: Download a file - optionally with a filename
short_docstring_tokens: Download a file - optionally with a filename
comment: """
          Download a file - optionally with a filename
          :param url: URL to be requested
          :param filename: optional filename
          :return: output filename
          """$SEP$# take filename if provided$SEP$# NOTE the stream=True parameter$SEP$# filter out keep-alive new chunks