code: def bufsize_validator(kwargs):
      
      invalid = []
  
      in_ob = kwargs.get("in", None)
      out_ob = kwargs.get("out", None)
  
      in_buf = kwargs.get("in_bufsize", None)
      out_buf = kwargs.get("out_bufsize", None)
  
      in_no_buf = ob_is_tty(in_ob) or ob_is_pipe(in_ob)
      out_no_buf = ob_is_tty(out_ob) or ob_is_pipe(out_ob)
  
      err = "Can't specify an {target} bufsize if the {target} target is a pipe or TTY"
  
      if in_no_buf and in_buf is not None:
          invalid.append((("in", "in_bufsize"), err.format(target="in")))
  
      if out_no_buf and out_buf is not None:
          invalid.append((("out", "out_bufsize"), err.format(target="out")))
  
      return invalid
docs: a validator to prevent a user from saying that they want custom
      buffering when they're using an in/out object that will be os.dup'd to the
      process, and has its own buffering.  an example is a pipe or a tty.  it
      doesn't make sense to tell them to have a custom buffering, since the os
      controls this.