code: def get_next_file_name(directory, prefix, extension):
      """Finds next available filename in directory by appending numbers to prefix.
  
      E.g. If prefix is 'myfile', extenstion is '.png', and 'directory' already
      contains 'myfile.png' and 'myfile1.png', this function will return
      'myfile2.png'.
  
      Args:
        directory: Path to the relevant directory.
        prefix: The filename prefix to use.
        extension: String extension of the file, eg. '.mid'.
      Returns:
        String name of the file.
      """
      name = directory + "/" + prefix + "." + extension
      i = 0
      while os.path.isfile(name):
          i += 1
          name = directory + "/" + prefix + str(i) + "." + extension
      return name
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import random
  from magenta.contrib import training
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 13 for calling a global function with example usage: get_next_file_name(directory, prefix, extension) and returns: name