def clean_title(text):
    """
    A little helper function to process a string into Title Case and
    remove any leading or trailing whitespaces.  If text is None,
    return None.

    Arguments:
    - `text`: the value returned from database row e.g. record.get('fieldname')

    """

    if text is None:
        return None
    else:
        return text.strip().title()