code: def checkFinite(value, name='value'):
          
          if math.isnan(value):
              raise GraphError('Encountered NaN %s' % (name,))
          elif math.isinf(value):
              raise GraphError('Encountered infinite %s' % (name,))
          return value
docs: Check that value is a finite number.
  
          If it is, return it. If not, raise GraphError describing the
          problem, using name in the error message.