def rand_bytes(length):
if not isinstance(length, int_types):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(length)<EOL>))<EOL><DEDENT>if length < <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if length > <NUM_LIT>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return os.urandom(length)<EOL>
Returns a number of random bytes suitable for cryptographic purposes

:param length:
    The desired number of bytes

:raises:
    ValueError - when any of the parameters contain an invalid value
    TypeError - when any of the parameters are of the wrong type
    OSError - when an error is returned by OpenSSL

:return:
    A byte string