def validate_string_or_none(option, value):
    """Validates that 'value' is an instance of `basestring` or `None`.
    """
    if value is None:
        return value
    return validate_string(option, value)
Validates that 'value' is an instance of `basestring` or `None`.
    
stackoverflow/venv/lib/python3.6/site-packages/pymongo/common.py