code: def build(cls, value: object, binary: bool = False,
                fallback: object = None) -> Union[Nil, 'String']:
          
          if value is None:
              if fallback is None:
                  return Nil()
              else:
                  return cls.build(fallback, binary)
          elif not value:
              return QuotedString(b'')
          elif isinstance(value, bytes):
              ascii_ = value
          elif isinstance(value, memoryview):
              ascii_ = bytes(value)
          elif hasattr(value, '__bytes__'):
              ascii_ = bytes(cast(SupportsBytes, value))
          elif isinstance(value, str) or hasattr(value, '__str__'):
              value = str(value)
              try:
                  ascii_ = bytes(value, 'ascii')
              except UnicodeEncodeError:
                  ascii_ = bytes(value, 'utf-8', 'replace')
                  return LiteralString(ascii_, binary)
          else:
              raise TypeError(value)
          if not binary and len(ascii_) < 64 \
                  and b'\n' not in ascii_ \
                  and b'\x00' not in ascii_:
              return QuotedString(ascii_)
          else:
              return LiteralString(ascii_, binary)
docs: Produce either a :class:`QuotedString` or :class:`LiteralString`
          based on the contents of ``data``. This is useful to improve
          readability of response data.
  
          Args:
              value: The string to serialize.
              binary: True if the string should be transmitted as binary.
              fallback: The default value to use if ``value`` is None.