code: def to_bytes(s, encoding=None, errors=None):
      '''Convert *s* into bytes'''
      if not isinstance(s, bytes):
          return ('%s' % s).encode(encoding or 'utf-8', errors or 'strict')
      elif not encoding or encoding == 'utf-8':
          return s
      else:
          d = s.decode('utf-8')
          return d.encode(encoding, errors or 'strict'f to_bytes(s, encoding=None, errors=None):
      '''Convert *s* into bytes'''
      if not isinstance(s, bytes):
          return ('%s' % s).encode(encoding or 'utf-8', errors or 'strict')
      elif not encoding or encoding == 'utf-8':
          return s
      else:
          d = s.decode('utf-8')
          return d.encode(encoding, errors or 'strict')
docs: Convert *s* into bytes