Based on the data returned from the Container output, via the iterator, write it to the appropriate streams

        Parameters
        ----------
        output_itr: Iterator
            Iterator returned by the Docker Attach command
        stdout: samcli.lib.utils.stream_writer.StreamWriter, optional
            Stream writer to write stdout data from Container into
        stderr: samcli.lib.utils.stream_writer.StreamWriter, optional
            Stream writer to write stderr data from the Container into

def _write_container_output(output_itr, stdout=None, stderr=None):
        """
        Based on the data returned from the Container output, via the iterator, write it to the appropriate streams

        Parameters
        ----------
        output_itr: Iterator
            Iterator returned by the Docker Attach command
        stdout: samcli.lib.utils.stream_writer.StreamWriter, optional
            Stream writer to write stdout data from Container into
        stderr: samcli.lib.utils.stream_writer.StreamWriter, optional
            Stream writer to write stderr data from the Container into
        """

        # Iterator returns a tuple of (frame_type, data) where the frame type determines which stream we write output
        # to
        for frame_type, data in output_itr:

            if frame_type == Container._STDOUT_FRAME_TYPE and stdout:
                # Frame type 1 is stdout data.
                stdout.write(data)

            elif frame_type == Container._STDERR_FRAME_TYPE and stderr:
                # Frame type 2 is stderr data.
                stderr.write(data)

            else:
                # Either an unsupported frame type or stream for this frame type is not configured
                LOG.debug("Dropping Docker container output because of unconfigured frame type. "
                          "Frame Type: %s. Data: %s", frame_type, data)