Returns num bytes of cryptographically strong pseudo-random
    bytes. If checkc_result is True, raises error if PRNG is not
    seeded enough

def bytes(num, check_result=False):
    """
    Returns num bytes of cryptographically strong pseudo-random
    bytes. If checkc_result is True, raises error if PRNG is not
    seeded enough
    """

    if num <= 0:
        raise ValueError("'num' should be > 0")
    buf = create_string_buffer(num)
    result = libcrypto.RAND_bytes(buf, num)
    if check_result and result == 0:
        raise RandError("Random Number Generator not seeded sufficiently")
    return buf.raw[:num]