

def gen_iplum(words=None, paragraphs=None):
    'Returns a lorem ipsum string. If no arguments are passed, then\n    return the entire default lorem ipsum string.\n\n    :param int words: The number of words to return.\n    :param int paragraphs: The number of paragraphs to return.\n    :raises: ``ValueError`` if ``words`` is not a valid positive integer.\n    :returns: A ``lorem ipsum`` string containing either the number of ``words``\n        or ``paragraphs``, extending and wrapping around the text as needed to\n        make sure that it has the specified length.\n    :rtype: str\n\n    '
    if ((words is None) or (words == 0)):
        words = len(LOREM_IPSUM_TEXT.split())
    if (paragraphs is None):
        paragraphs = 1
    if ((not isinstance(words, int)) or (words < 0)):
        raise ValueError('Cannot generate a string with negative number of words.')
    _is_positive_int(paragraphs)
    all_words = LOREM_IPSUM_TEXT.split()
    total_words_needed = (words * paragraphs)
    quotient = int((total_words_needed / len(all_words)))
    modulus = (total_words_needed % len(all_words))
    all_words = (all_words * (quotient + modulus))
    result = ''
    start_pos = 0
    for _ in range(0, paragraphs):
        sentence = ' '.join(all_words[start_pos:(start_pos + words)])
        if sentence.endswith(','):
            sentence = sentence.rstrip(',')
        if sentence.endswith('.'):
            sentence = sentence.rstrip('.')
        cap_sentence = [(frag.capitalize() + '.') for frag in sentence.split('. ')]
        result += (' '.join(cap_sentence) + '\n')
        start_pos += words
    return _make_unicode(result.rstrip())

dataset/ETHPy150Open omaciel/fauxfactory/fauxfactory/__init__.py gen_iplum/original