<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_euid():
 """ Set settings.DROPLET_USER effective UID for the current process This adds some security, but nothing magic, an attacker can still gain root access, but at least we only elevate privileges when needed See root context manager """

    current = os.geteuid()
    logger.debug("Current EUID is %s" % current)

    if settings.DROPLET_USER is None:
        logger.info("Not changing EUID, DROPLET_USER is None")
        return

    uid = int(pwd.getpwnam(settings.DROPLET_USER).pw_uid)
    if current != uid:
        try:
            os.seteuid(uid)
            logger.info("Set EUID to %s (%s)" %
                        (settings.DROPLET_USER, os.geteuid()))
        except:
            current_user = pwd.getpwuid(os.getuid()).pw_name
            logger.error("Failed to set '%s' EUID, running as '%s'" %
                         (settings.DROPLET_USER, current_user))
    else:
        logger.debug("Didn't set EUID, it was already correct")