def get_hostname():
    """
    Will fetch current hostname of VM if any and return.
    Looks at /etc/conf.d/hostname config for Gentoo server.
    """
    try:
        with open(HOSTNAME_FILE) as hostname_fyl:
            for line in hostname_fyl.readlines():
                hn = re.search('HOSTNAME="(.*)"', line)
                if hn:
                    return hn.group(1)
        return None

    except Exception, e:
        logging.info(str(e) % "Current Gentoo hostname enquiry failed: %s")
        return None
dataset/ETHPy150Open rackerlabs/openstack-guest-agents-unix/commands/gentoo/network.py/get_hostname/swapped operands of `%`