code: def bovy_end_print(filename,**kwargs):
      
      if 'format' in kwargs:
          pyplot.savefig(filename,**kwargs)
      else:
          pyplot.savefig(filename,format=re.split(r'\.',filename)[-1],**kwargs)
      pyplot.close()
docs: NAME:
  
         bovy_end_print
  
      PURPOSE:
  
         saves the current figure(s) to filename
  
      INPUT:
  
         filename - filename for plot (with extension)
  
      OPTIONAL INPUTS:
  
         format - file-format
  
      OUTPUT:
  
         (none)
  
      HISTORY:
  
         2009-12-23 - Written - Bovy (NYU)