Convert a single frame into bytes that can be transmitted on
        the stream.

        :param frame: The frame to convert.  Should be the same type
                      of object returned by ``to_frame()``.
        :param state: An instance of ``FramerState``.  This object may
                      be used to track information across calls to the
                      method.

        :returns: Bytes that may be transmitted on the stream.

def to_bytes(self, frame, state):
        """
        Convert a single frame into bytes that can be transmitted on
        the stream.

        :param frame: The frame to convert.  Should be the same type
                      of object returned by ``to_frame()``.
        :param state: An instance of ``FramerState``.  This object may
                      be used to track information across calls to the
                      method.

        :returns: Bytes that may be transmitted on the stream.
        """

        # Generate the bytes from the frame
        frame = six.binary_type(frame)
        return self.encode_length(frame, state) + frame