def get_querystring_fields(serializer, arg_name):
    """
    Gets a list of fields from the querystring that exist in the serializer

    """
    if 'request' in serializer.context:
        fields = serializer.context['request'].query_params.get(arg_name, None)
        if fields:
            fields = fields.split(',')
            allowed = set(fields)
            existing = set(serializer.fields.keys())
            return allowed & existing
    return None
