def limit_clause(n, offset=None):
    """ Generate an LIMIT clause, with OFFSET if provided.

        Args:
            n: The number of rows to get.
            offset: The offset number. If None, no offset is added.

        Return:
            The completed clause
    """
    limit_str = 'LIMIT {}'.format(n)

    if offset:
        limit_str += ' OFFSET {}'.format(offset)
    
    return limit_str