def uuidify(val):
    """Takes an integer and transforms it to a UUID format.

    returns: UUID formatted version of input.
    """
    if uuidutils.is_uuid_like(val):
        return val
    else:
        try:
            int_val = int(val, 16)
        except ValueError:
            with excutils.save_and_reraise_exception():
                LOG.error(_LE("Invalid UUID format %s. Please provide an "
                              "integer in decimal (0-9) or hex (0-9a-e) "
                              "format"), val)
        res = str(int_val)
        num = 12 - len(res)
        return "00000000-0000-0000-0000-" + "0" * num + res
dataset/ETHPy150Open openstack/networking-cisco/networking_cisco/plugins/cisco/device_manager/config.py/uuidify/original