def random_string(length, char_range=127, char_offset=128):
    """Returns a string of `length` random characters in the interval
       (`char_offset`, `char_offset + char_range`).
    """
    from random import random
    return ''.join(chr(int(random() * char_range + char_offset)) for c in
        range(length))
