code: def upload_to_mugshot(instance, filename):
      
      extension = filename.split('.')[-1].lower()
      salt, hash = generate_sha1(instance.pk)
      path = userena_settings.USERENA_MUGSHOT_PATH % {'username': instance.user.username,
                                                      'id': instance.user.id,
                                                      'date': instance.user.date_joined,
                                                      'date_now': get_datetime_now().date()}
      return '%(path)s%(hash)s.%(extension)s' % {'path': path,
                                                 'hash': hash[:10],
                                                 'extension': extension}
docs: Uploads a mugshot for a user to the ``USERENA_MUGSHOT_PATH`` and saving it
      under unique hash for the image. This is for privacy reasons so others
      can't just browse through the mugshot directory.