class_docstr: Interact with Alibaba Cloud OSS, using the oss2 library.
class_docstr_tok: ["Interact","with","Alibaba","Cloud","OSS",",","using","the","oss2","library","."]
docstr: Download file from OSS.
  
  :param key: key of the file-like object to download.
  :param local_file: local path + file name to save.
  :param bucket_name: the name of the bucket
  :return: the file name.
docstr_tok: ["Download","file","from","OSS",".",":","param","key",":","key","of","the","file-like","object","to","download",".",":","param","local_file",":","local","path","+","file","name","to","save",".",":","param","bucket_name",":","the","name","of","the","bucket",":","return",":","the","file","name","."]
code: def download_file(
      self,
      key: str,
      local_file: str,
      bucket_name: str | None = None,
  ) -> str | None:
      """
      Download file from OSS.
  
      :param key: key of the file-like object to download.
      :param local_file: local path + file name to save.
      :param bucket_name: the name of the bucket
      :return: the file name.
      """
      try:
          self.get_bucket(bucket_name).get_object_to_file(
              key, local_file
          )
      except Exception as e:
          self.log.error(e)
          return None
      return local_file
  
imports: from __future__ import annotations
  from functools import wraps
  from inspect import signature
  from typing import TYPE_CHECKING, Callable, TypeVar, cast
  from urllib.parse import urlsplit
  import oss2
  from oss2.exceptions import ClientError
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 8 for calling the OSSHook obj's underlying member method code with example usage: obj.download_file(key, local_file, bucket_name) and returns: local_file, None