def METHOD_NAME(analysis_input: str) -> Optional[List[Dict]]:
    """
    Return a compilation database that describes the build of the given
    analysis_input:
    - If analysis_input is a compilation database JSON file then its entries
      return.
    - If analysis_input is a C/C++/Obj-C source file then the corresponding
      build command is found from the compilation database. Only the innermost
      compilation database is checked (see find_closest_compilation_database()
      for details).
    - If analysis_input is a directory then a compilation database with the
      build commands of all C/C++/Obj-C files in it return.
    If none of these apply (e.g. analysis_input is a Python source file which
    doesn't have a compilation database) then None returns.
    """
    def __select_compilation_database(
        comp_db_paths: List[str],
        source_file: str
    ) -> Optional[str]:
        """
        Helper function for selecting the corresponding compilation database
        for the given source file, i.e. the compilation database in the closest
        parent directory, even if it doesn't contain a build action belonging
        to this file.
        """
        comp_db_paths = list(map(os.path.dirname, comp_db_paths))
        longest = os.path.commonpath(comp_db_paths + [source_file])
        if longest in comp_db_paths:
            return os.path.join(longest, COMPILATION_DATABASE)
    # Case 1: analysis_input is a compilation database JSON file.
    build_actions = load_json(analysis_input, display_warning=False)
    if build_actions is not None:
        pass
    # Case 2: analysis_input is a C/C++/Obj-C source file.
    elif is_c_lang_source_file(analysis_input):
        build_actions = find_build_actions_for_file(analysis_input)
    # Case 3: analysis_input is a directory.
    elif os.path.isdir(analysis_input):
        compilation_database_files = \
            find_all_compilation_databases(analysis_input)
        build_actions = []
        for comp_db_file in compilation_database_files:
            comp_db = load_json(comp_db_file)
            if not comp_db:
                continue
            for ba in comp_db:
                file_path = os.path.join(ba["directory"], ba["file"])
                if os.path.commonpath([file_path, analysis_input]) \
                        == analysis_input and __select_compilation_database(
                        compilation_database_files,
                        file_path) == comp_db_file:
                    build_actions.append(ba)
    # Compilation database transformation.
    if build_actions is not None:
        change_args_to_command_in_comp_db(build_actions)
    return build_actions