def validate_location(self, project, location_id):
        errors = []
        self.location = None

        try:
            if location_id is not None:
                self.location = Location.objects.get_single(
                    self.context.get('user'),
                    project.id,
                    location_id
                )
        except PermissionDenied, error:
            errors.append(error)
        except Location.DoesNotExist, error:
            errors.append(error)

        if errors:
            self._errors['location'] = errors
Filters empty values from container types
dataset/ETHPy150Open ExCiteS/geokey/geokey/contributions/serializers.py/ContributionSerializer.validate_location--crossover with--dataset/ETHPy150Open CenterForOpenScience/scrapi/scrapi/linter/document.py/do_strip_empty