def getShortHostnameFromNodename(nodename):
    """Extracts the short hostname from a node name.

    Relies upon the convention that node names usually start
    with the short hostname followed by the string 'Node',
    for example 'ding4Node01'.

    Returns the short hostname if the string 'Node' is present
    and if the short hostname is more than 3 characters in length.
    Otherwise returns the full node name.
    """
    #print 'getShortHostnameFromNodename: Entry. nodename=' + nodename
    shn = nodename
    ix = nodename.find('Node')
    #print 'getShortHostnameFromNodename: ix=%d' % (ix)
    if ix != -1 :
        #print 'getShortHostnameFromNodename: nodename contains Node'
        if ix > 2 :
            shn = nodename[0:ix]
    #print 'getShortHostnameFromNodename: Exit. shn=' + shn
    return shn