code: def make_directory_if_needed(directory_path):
      
      if os.path.exists(directory_path):
          if not os.path.isdir(directory_path):
              raise OSError("Path is not a directory:", directory_path)
      else:
          os.makedirs(directory_path)
docs: Make the directory path, if needed.