@classmethod
def check_string(cls, label, value, non_empty=False):
    """Checks if the given value is a string."""
    if value is None:
        return None
    if not isinstance(value, str):
        if non_empty:
            raise ValueError('{0} must be a non-empty string.'.format(label))
        raise ValueError('{0} must be a string.'.format(label))
    if non_empty and not value:
        raise ValueError('{0} must be a non-empty string.'.format(label))
    return value
