(s)
return s
assert type of s is basestring and convert s to byte string
assert type of s is basestring and convert s to byte string
assert type of s is basestring and convert s to byte string
def ensure_bin_str(s):
    """assert type of s is basestring and convert s to byte string"""
    assert isinstance(s, basestring), 's should be string'
    if isinstance(s, unicode):
        s = s.encode('utf-8')
    return s
def ensure_bin_str ( s ) : assert isinstance ( s , basestring ) , 's should be string' if isinstance ( s , unicode ) : s = s . encode ( 'utf-8' ) return s