comefrom: <garvit244>393_1.py
code: def validUtf8( data):
      seveneth_mask = 1 << 7
      sixth_mask = 1 << 6
      no_bytes = 0
      
      if len(data) == 1:
          return not(data[0] & seveneth_mask)
      
      for num in data:
          if no_bytes == 0:
              mask = 1 << 7
              
              while num & mask:
                  no_bytes += 1
                  mask >>= 1
                  
              if no_bytes == 0:
                  continue
                  
              if no_bytes == 1 or no_bytes > 4:
                  return False
          else:
              if not(num & seveneth_mask and not(num & sixth_mask)):
                  return False
          no_bytes -= 1
      return no_bytes == 0
masked: def sample_funcname ( var_0 ) :
      var_3 = 1 << 7
      var_5 = 1 << 6
      var_7 = 0
      if len ( var_0 ) == 1 :
          return not ( var_0 [ 0 ] & var_3 )
      for var_9 in var_0 :
          if var_7 == 0 :
              var_10 = 1 << 7
              while var_9 & var_10 :
                  var_7 += 1
                  var_10 >>= 1
              if var_7 == 0 :
                  continue
              if var_7 == 1 or var_7 > 4 :
                  return False
          else :
              if not ( var_9 & var_3 and not ( var_9 & var_5 ) ) :
                  return False
          var_7 -= 1
      return var_7 == 0
  