def guid_check_convert(guid, allow_none=False):
        """Take a GUID in the form of hex string "32" or "8-4-4-4-12".
        Returns hex string "32" or raises ValueError: badly formed hexadecimal UUID string
        """
        if isinstance(guid, string_types):
            return ensure_unicode(UUID(guid).hex)
        elif guid is None and allow_none:
            return None
        else:
            raise ValueError('guid must be a string')