code: def _listdir(pth, extensions):
      
      try:
          return [fname for fname in os.listdir(pth)
                  if os.path.splitext(fname)[1] in extensions]
      except OSError:  # pragma: nocover
          pass
docs: Non-raising listdir.