'Helper function to make up random stream names. It takes
existing_stream_names and randomly appends a digit to the end of each,
but avoids names that appear in the list names_to_avoid.'

def make_random_stream_names(self, existing_stream_names):

    random_streams = []
    all_stream_names = [stream.name for stream in Stream.objects.filter(realm=self.test_realm)]
    for stream in existing_stream_names:
        random_stream = (stream + str(random.randint(0, 9)))
        if (random_stream not in all_stream_names):
            random_streams.append(random_stream)
    return random_streams
