code: def add_bits_to_path(path_, filename_prefix=None, extension=None):
      
  
      dir_, basename = os.path.split(path_)
  
      if filename_prefix:
          basename = filename_prefix+basename
      if extension:
          if not extension.startswith("."):
              extension = "."+extension
          basename = basename+extension
  
      return os.path.join(dir_, basename)
docs: Adds prefix/suffix to filename
  
      Arguments:
          path_ -- path to file
          filename_prefix -- prefix to be added to file name
          extension -- extension to be added to file name. The dot is automatically added, such as
              "ext" and ".ext" will have the same effect
  
      Examples:
          > add_bits_to_path("/home/user/file", "prefix-")
          /home/user/prefix-file
  
          > add_bits_to_path("/home/user/file", None, ".ext")
          /home/user/file.ext
  
          > add_bits_to_path("/home/user/file", None, "ext")  # dot in extension is optional
          /home/user/file.ext
  
          > add_bits_to_path("/home/user/", None, ".ext")
          /home/user/.ext