docs: def make_streams(name, value, boundary, encoding):
      """Generates one or more streams for each name, value pair"""
  
      filename = None
      mime = None
  
      # user passed in a special dict.
      if isinstance(value, collections.Mapping) and "name" in value and "value" in value:
          filename = value["name"]
          try:
              mime = value["mime"]
          except KeyError:
              pass
          value = value["value"]
  
      if not filename:
          filename = getattr(value, "name", None)
          if filename:
              filename = os.path.split(filename)[1]
  
      mime = mime or "application/octet-stream"
  
      name, filename, mime = [escape_header(v) for v in (name, filename, mime)]
  
      stream = BytesIO()
      stream.write("--{}\r\n".format(boundary).encode(encoding))
      if not filename:
          stream.write(
              'Content-Disposition: form-data; name="{}"\r\n'.format(name).encode(
                  encoding
              )
          )
      else:
          stream.write(
              'Content-Disposition: form-data; name="{}"; filename="{}"\r\n'.format(
                  name, filename
              ).encode(encoding)
          )
          if mime:
              stream.write("Content-Type: {}\r\n".format(mime).encode(encoding))
      stream.write(b"\r\n")
  
      if hasattr(value, "read"):
          stream.seek(0)
          return stream, value, BytesIO("\r\n".encode(encoding))
  
      # not a file-like object, encode headers and value in one go
      value = value if isinstance(value, (str, bytes)) else json.dumps(value)
      if isinstance(value, bytes):
          stream.write(value)
      else:
          stream.write(value.encode(encoding))
      stream.write(b"\r\n")
      stream.seek(0)
      return (stream,)