def _isProcessRunningOnWindows(pid):
    """
    Enumerates active processes as seen under windows Task Manager on Win
    NT/2k/XP using PSAPI.dll (new api for processes) and using ctypes.Use it as
    you please.

    Based on information from
    http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q175030&ID=KB;EN-US;Q175030

    By Eric Koome email ekoome@yahoo.com
    license GPL

    (adapted from code found at
    http://code.activestate.com/recipes/305279-getting-process-information-on-windows/)
    """
    from ctypes import windll, c_ulong, sizeof, byref
    psapi = windll.psapi
    arr = c_ulong * 256
    list_of_pids = arr()
    cb = sizeof(list_of_pids)
    cb_needed = c_ulong()
    psapi.EnumProcesses(byref(list_of_pids), cb, byref(cb_needed))
    number_of_pids = int(cb_needed.value / sizeof(c_ulong()))
    pid_list = list(list_of_pids)[:number_of_pids]
    return int(pid) in pid_list
