def detect_compiler(libpath):
    """Determines the compiler used to compile the specified shared library by
    using the system utilities.

    :arg libpath: the full path to the shared library *.so file.
    """
    from os import waitpid, path
    from subprocess import Popen, PIPE
    command = "nm {0}".format(path.abspath(libpath))
    child = Popen(command, shell=True, executable="/bin/bash", stdout=PIPE)
    # Need to do this so that we are sure the process is done before moving on
    waitpid(child.pid, 0)
    contents = child.stdout.readlines()
    i = 0
    found = False
    while i < len(contents) and found == False:
        if "_MOD_" in contents[i]:
            found = "gfortran"
        elif "_mp_" in contents[i]:
            found = "ifort"
        i += 1

    return found
Determines the compiler used to compile the specified shared library by
    using the system utilities.

    :arg libpath: the full path to the shared library *.so file.