code: def getmlsthelper(referencefilepath, start, organism, update):
      from accessoryFunctions.accessoryFunctions import GenObject
      organismset = set()
      organism = organism if organism != 'Shigella' else 'Escherichia'
      organismdictionary = {'Escherichia': 'Escherichia coli
                            'Shigella': 'Escherichia coli
                            'Vibrio': 'Vibrio parahaemolyticus',
                            'Campylobacter': 'Campylobacter jejuni',
                            'Listeria': 'Listeria monocytogenes',
                            'Bacillus': 'Bacillus cereus',
                            'Klebsiella': 'Klebsiella pneumoniae'}
      try:
          organismset.add(organismdictionary[organism])
      except KeyError:
          organismset.add(organism)
      for scheme in organismset:
          organismpath = os.path.join(referencefilepath, 'MLST', organism)
          try:
              lastfolder = sorted(glob('{}/*/'.format(organismpath)))[-1].rstrip('/')
          except IndexError:
              lastfolder = []
          delta, foldersize, d1 = schemedate(lastfolder)
          newfolder = '{}/{}'.format(organismpath, d1)
          if update:
              if delta.days > 7 or foldersize < 100:
                  printtime('Downloading {} MLST scheme from pubmlst.org'.format(organism), start)
                  getmlstargs = GenObject()
                  getmlstargs.species = scheme
                  getmlstargs.repository_url = 'http://pubmlst.org/data/dbases.xml'
                  getmlstargs.force_scheme_name = False
                  getmlstargs.path = newfolder
                  make_path(getmlstargs.path)
                  getmlst.main(getmlstargs)
                  try:
                      profilestart = open(glob('{}/*.txt'.format(newfolder))[0]).readline()
                  except IndexError:
                      profilestart = []
                  if not profilestart or profilestart[0] == '<':
                      shutil.rmtree(newfolder)
                      newfolder = lastfolder
              else:
                  newfolder = lastfolder
          else:
              newfolder = lastfolder
          try:
              newfoldersize = sum(os.path.getsize('{}/{}'.format(newfolder, f)) for f in os.listdir(newfolder)
                                  if os.path.isfile('{}/{}'.format(newfolder, f)))
          except (OSError, TypeError):
              newfoldersize = 100
          if newfoldersize < 100:
              shutil.rmtree(newfolder)
              try:
                  newfolder = sorted(glob('{}/*/'.format(organismpath)))[-1].rstrip('/')
              except IndexError:
                  newfolder = organismpath
          return newfolder