import string
import random


def _random_string(length, chars=string.ascii_lowercase, prefix='', suffix=''):
    """
    Return a random string with given length, prefix and suffix.
    The random characters are chosen from the chars iterable (lowercase
    letters by default)
    """
    r = ''.join(random.choice(chars) for i in range(length))
    return prefix + r + suffix