def render_field_and_label(field, label, field_class='', label_for=None, label_class='', layout='', **kwargs):
    'Render a field with its label.'
    if (layout == 'horizontal'):
        if (not label_class):
            label_class = get_bootstrap_setting('horizontal_label_class')
        if (not field_class):
            field_class = get_bootstrap_setting('horizontal_field_class')
        if (not label):
            label = mark_safe('&#160;')
        label_class = add_css_class(label_class, 'control-label')
    html = field
    if field_class:
        html = f'<div class="{field_class}">{html}</div>'
    if label:
        html = (render_label(label, label_for=label_for, label_class=label_class) + html)
    return html
Render a field with its label.
def render_field_and_label(field, label, field_class=, label_for=None, label_class=, layout=, **kwargs):
    
    if (layout == 'horizontal'):
        if (not label_class):
            label_class = get_bootstrap_setting('horizontal_label_class')
        if (not field_class):
            field_class = get_bootstrap_setting('horizontal_field_class')
        if (not label):
            label = mark_safe('&#160;')
        label_class = add_css_class(label_class, 'control-label')
    html = field
    if field_class:
        html = f'<div class="{field_class}">{html}</div>'
    if label:
        html = (render_label(label, label_for=label_for, label_class=label_class) + html)
    return html