I have a rather clunky function that returns a number based on certain values:local = {'abs154': '4'}w12,sv2,sv4,sv6,sv8,sv10,sv12=75,95,110,104,101,110,116 supers = [[5, w12], [6, w12], [7, w12], [8, w12], [16, w12], [17, w12], [18, w12], [9, sv2], [11, sv2], [12, sv2], [13, sv2], [14, sv2], [15, sv2], [19, sv4], [23, sv4], [24, sv4], [25, sv4], [26, sv4], [28, sv6], [29, sv6], [30, sv6], [31, sv6], [32, sv6], [33, sv6], [35, sv8], [36, sv8], [37, sv8], [38, sv8], [39, sv8], [40, sv8], [41, sv8], [42, sv8], [43, sv8], [44, sv8], [45, sv8], [46, sv8], [47, sv8], [48, sv8], [49, sv8], [50, sv8], [52, sv10], [53, sv10], [55, sv10], [57, sv10], [58, sv10], [59, sv10], [60, sv10], [61, sv10], [62, sv10], [63, sv10], [64, sv10], [65, sv10], [66, sv10], [68, sv2], [71, sv12], [72, sv12], [73, sv12], [74, sv12], [75, sv12], [76, sv12], [77, sv12], [78, sv12], [79, sv12], [80, sv12], [81, sv12], [82, sv12], [83, sv12], [84, sv12]] def Server(group):       try: sn = local[group]       except KeyError:             group = group.replace(-, q)             fnv = float(int(group[0:min(5, len(group))], 36))             lnv = group[6: (6 + min(3, len(group) - 5))]             if(lnv):                 lnv = float(int(lnv, 36))                 lnv = max(lnv,1000)             else:                 lnv = 1000             num = (fnv % lnv) / lnv             maxnum = sum(map(lambda x: x[1], supers))             cumfreq = 0             sn = 0             for wgt in supers:                 cumfreq += float(wgt[1]) / maxnum                 if(num <= cumfreq):                     sn = int(wgt[0])                     break       return s + str(sn) + .website.comThis all looks rather unnecessary.  I would like to make it shorter and cleaner if possible.
Cleaning and simplifying function that returns a number based on certain values
python;mathematics