code: def extension_from_filename(filename):
      
      # Parse out any extension specified in filename
      _indx1 = filename.find('[')
      _indx2 = filename.find(']')
      if _indx1 > 0:
          # check for closing square bracket:
          if _indx2 < _indx1:
              raise RuntimeError("Incorrect extension specification in file " \
                                  "name \'%s\'." % filename)
          # Read extension name provided
          _fname = filename[:_indx1]
          _extn = filename[_indx1+1:_indx2].strip()
      else:
          _fname = filename
          _extn = None
  
      return _fname, _extn
docs: Parse out filename from any specified extensions.
      Returns rootname and string version of extension name.