Validate the length of value, if min_length or max_length was specified

def validate_length(self, value):
        """Validate the length of value, if min_length or max_length was specified"""
        list_len = len(value) if value else 0

        if self.max_length is not None and list_len > self.max_length:
            raise ValidationError(
                u'List has {} values; max length is {}'.format(list_len, self.max_length))

        if self.min_length is not None and list_len < self.min_length:
            raise ValidationError(
                u'List has {} values; min length is {}'.format(list_len, self.min_length))