def write_omega_scan_config(channellist, fobj, header=True):
if isinstance(fobj, FILE_LIKE):<EOL><INDENT>close = False<EOL><DEDENT>else:<EOL><INDENT>fobj = open(fobj, '<STR_LIT:w>')<EOL>close = True<EOL><DEDENT>try:<EOL><INDENT>if header:<EOL><INDENT>print('<STR_LIT>', file=fobj)<EOL>print('<STR_LIT>', file=fobj)<EOL><DEDENT>group = None<EOL>for channel in channellist:<EOL><INDENT>if channel.group != group:<EOL><INDENT>group = channel.group<EOL>print('<STR_LIT>' % group, file=fobj)<EOL><DEDENT>print("<STR_LIT>", file=fobj)<EOL>print_omega_channel(channel, file=fobj)<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>if close:<EOL><INDENT>fobj.close()<EOL><DEDENT><DEDENT>
Write a `ChannelList` to an Omega-pipeline scan configuration file

    This method is dumb and assumes the channels are sorted in the right
    order already