code: def str2long(s):
      
      if type(s) not in (types.StringType, types.UnicodeType):
          raise ValueError('the input must be a string')
  
      l = 0
      for i in s:
          l <<= 8
          l |= ord(i)
  
      return l
docs: Convert a string to a long integer.