def dumps(obj):
    """converts a swatch to bytes suitable for writing"""
    header = b'ASEF'
    v_major, v_minor = 1, 0
    chunk_count = writer.chunk_count(obj)

    head = struct.pack('!4sHHI', header, v_major, v_minor, chunk_count)
    body = b''.join([writer.chunk_for_object(c) for c in obj])
    return head + body