import io


def iostr_to_iobytes(fs):
    """ Converts io.StringIO object to io.BytesIO
    Paramters
    _________
    fs : io.StringIO

    Returns
    _______
    fb : io.BytesIO
    """
    fs.flush()
    fs.seek(0)
    fb = io.BytesIO(fs.read().encode())
    return fb