def utf8_cut(bytestr, maxlen):
    """Cuts an utf8 bytestring in two parts where the left is at most maxlen
    long, and both are valid utf8 strings.
    """
    left = bytestr[:maxlen].decode('utf-8', 'ignore').encode('utf-8')
    return left, bytestr[len(left):]
