def METHOD_NAME(state_type, slug=None):
    f = self.fields['state']
    f.queryset = f.queryset.filter(used=True).filter(type=state_type)
    if slug:
        f.queryset = f.queryset.filter(slug=slug)
    if len(f.queryset) == 1:
        f.initial = f.queryset[0].pk
        f.widget = forms.HiddenInput()