def rndbytes(size=16, alphabet=""):
    """
    Returns rndstr always as a binary type
    """
    x = rndstr(size, alphabet)
    if isinstance(x, six.string_types):
        return x.encode('utf-8')
    return x
def rndbytes ( size = 16 , alphabet = "" ) : x = rndstr ( size , alphabet ) if isinstance ( x , six . string_types ) : return x . encode ( 'utf-8' ) return x
Returns rndstr always as a binary type