code: def _bin_to_dec(ip, check=True):
      
      if check and not is_bin(ip):
          raise ValueError('_bin_to_dec: invalid IP: "%s"' % ip)
      if isinstance(ip, int):
          ip = str(ip)
      return int(str(ip), 2)
docs: Binary to decimal conversion.