def format_seq(self, outstream=None, linewidth=<NUM_LIT>):
if linewidth == <NUM_LIT:0> or len(self.seq) <= linewidth:<EOL><INDENT>if outstream is None:<EOL><INDENT>return self.seq<EOL><DEDENT>else:<EOL><INDENT>print(self.seq, file=outstream)<EOL>return<EOL><DEDENT><DEDENT>i = <NUM_LIT:0><EOL>seq = '<STR_LIT>'<EOL>while i < len(self.seq):<EOL><INDENT>if outstream is None:<EOL><INDENT>seq += self.seq[i:i+linewidth] + '<STR_LIT:\n>'<EOL><DEDENT>else:<EOL><INDENT>print(self.seq[i:i+linewidth], file=outstream)<EOL><DEDENT>i += linewidth<EOL><DEDENT>if outstream is None:<EOL><INDENT>return seq<EOL><DEDENT>
Print a sequence in a readable format.

:param outstream: if `None`, formatted sequence is returned as a
                  string; otherwise, it is treated as a file-like
                  object and the formatted sequence is printed to the
                  outstream
:param linewidth: width for wrapping sequences over multiple lines; set
                  to 0 for no wrapping