code: def prepare_content_length(self, body):
          
          if body is not None:
              length = super_len(body)
              if length:
                  # If length exists, set it. Otherwise, we fallback
                  # to Transfer-Encoding: chunked.
                  self.headers['Content-Length'] = builtin_str(length)
          elif self.method not in ('GET', 'HEAD') and self.headers.get('Content-Length') is None:
              # Set Content-Length to 0 for methods that can have a body
              # but don't provide one. (i.e. not GET or HEAD)
              self.headers['Content-Length'] = '0'
docs: Prepare Content-Length header based on request method and body