def METHOD_NAME(length):
    # Given "3.4in" return the width in pixels
    global pixelsPerInch
    global unitHash
    m = re.search('([+-]?[\d\.]+)(\S+)', length)
    if m != None and m.lastindex > 1:
        unit = pixelsPerInch
        if unitHash.has_key(m.group(2)):
            unit = unitHash[m.group(2)]
        else:
            print "Unrecognized length: " + m.group(2)
        pixels = unit * float(m.group(1))
    else:
        pixels = 0
    return pixels