<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_staff_updater(cls):
 """ This returns a function for passing to a signal. """

    from django.core.exceptions import ImproperlyConfigured
    if not issubclass(cls, BaseStaffMember):
        raise ImproperlyConfigured("%s is not a sublass of StaffMember" % cls)

    def update_staff_member(sender, instance, created, *args, **kwargs):
        """
        Update the Staff Member instance when a User object is changed.
        """
        if instance.is_staff and not cls.objects.filter(user=instance).count():
            staffmember = cls(
                user=instance,
                is_active=True)
            staffmember.save()
        elif instance.is_staff:
            staffmembers = cls.objects.filter(user=instance)
            if len(staffmembers):
                staffmember = staffmembers[0]
                staffmember.is_active = True
                if instance.first_name != staffmember.first_name:
                    staffmember.first_name = instance.first_name
                    staffmember.slug = slugify('%s %s' % (
                        instance.first_name, instance.last_name))
                if instance.last_name != staffmember.last_name:
                    staffmember.last_name = instance.last_name
                    staffmember.slug = slugify('%s %s' % (
                        instance.first_name, instance.last_name))
                if instance.email != staffmember.email:
                    staffmember.email = instance.email
                staffmember.save()
        elif not instance.is_staff:
            # Make sure we deactivate any staff members associated with this user
            for staffmember in cls.objects.filter(user=instance):
                staffmember.is_active = False
                staffmember.save()
        from django.db import transaction
        transaction.commit_unless_managed()

    return update_staff_member