code: def web_err(i):
  
      
  
      http=i['http']
      tp=i['type']
      bin=i['bin']
  
      try: bin=bin.decode('utf-8')
      except Exception as e: pass
  
      if tp=='json':
         rx=ck.dumps_json({'dict':{'return':1, 'error':bin}})
         if rx['return']>0:
            bin2=rx['error'].encode('utf8')
         else:
            bin2=rx['string'].encode('utf-8')
      elif tp=='con':
         bin2=bin.encode('utf8')
      else:
         bin2=b'<html><body><pre>'+bin.encode('utf8')+b'</pre></body></html>'
  
      i['bin']=bin2
      return web_out(i)
docs: Input:  {
                http - http object
                type - content type
                bin  - bytes to output
              }
  
      Output: {
                return - 0
              }