code: def get_libgfortran_dir():
      
      for ending in [".3.dylib", ".dylib", ".3.so", ".so"]:
          try:
              p = Popen(['gfortran', "-print-file-name=libgfortran" + ending],
                        stdout=PIPE, stderr=PIPE)
              p.stderr.close()
              line = p.stdout.readline().decode().strip()
              p.stdout.close()
              if os.path.exists(line):
                  return [os.path.dirname(line)]
          except:
              continue
          return []
docs: Helper function returning the library directory of libgfortran. Useful
      on OSX where the C compiler oftentimes has no knowledge of the library
      directories of the Fortran compiler. I don't think it can do any harm on
      Linux.