'Validate an activation key and activate the corresponding
``User`` if valid.
If the key is valid and has not expired, return the ``User``
after activating.
If the key is not valid or has expired, return ``False``.'

def activate_user(self, activation_key, request=None):

    if SHA1_RE.search(activation_key):
        try:
            profile = self.get(activation_key=activation_key)
        except self.model.DoesNotExist:
            profile = None
            statsd.incr('user.activate-error.does-not-exist')
            reason = 'key    not    found'
        if profile:
            if (not profile.activation_key_expired()):
                user = profile.user
                user.is_active = True
                user.save()
                profile.delete()
                if user.groups.filter(name=CONTRIBUTOR_GROUP):
                    self._send_email(confirmation_profile=profile, url=None, subject=_('Welcome    to    SUMO!'), text_template='users/email/contributor.ltxt', html_template='users/email/contributor.html', send_to=user.email, contributor=user)
                return user
            else:
                statsd.incr('user.activate-error.expired')
                reason = 'key    expired'
    else:
        statsd.incr('user.activate-error.invalid-key')
        reason = 'invalid    key'
    log.warning(u'User    activation    failure    ({r}):    {k}'.format(r=reason, k=activation_key))
    return False
