def _fix_name(self, prefix, name):
        """
        Apply some fixes to element named and attribute names.
        Try to get conform to:
        > Like element names, attribute names are case-sensitive and must start with a letter or underscore.
        > The rest of the name can contain letters, digits, hyphens, underscores, and periods.
        See: https://msdn.microsoft.com/en-us/library/ms256152(v=vs.110).aspx

        This function tries to fix some broken namespace mappings.
        In some cases, the namespace prefix is inside the name and not in the prefix field.
        Then, the tag name will usually look like 'android:foobar'.
        If and only if the namespace prefix is inside the namespace mapping and the actual prefix field is empty,
        we will strip the prefix from the attribute name and return the fixed prefix URI instead.
        Otherwise replacement rules will be applied.

        The replacement rules work in that way, that all unwanted characters are replaced by underscores.
        In other words, all characters except the ones listed above are replaced.

        :param name: Name of the attribute or tag
        :param prefix: The existing prefix uri as found in the AXML chunk
        :return: a fixed version of prefix and name
        :rtype: tuple
        """
        if not name[0].isalpha() and name[0] != "_":
            log.warning("Invalid start for name '{}'. "
                        "XML name must start with a letter.".format(name))
            self.packerwarning = True
            name = "_{}".format(name)
        if name.startswith("android:") and prefix == '' and 'android' in self.axml.nsmap:
            # Seems be a common thing...
            log.info("Name '{}' starts with 'android:' prefix but 'android' is a known prefix. Replacing prefix.".format(name))
            prefix = self._print_namespace(self.axml.nsmap['android'])
            name = name[len("android:"):]
            # It looks like this is some kind of packer... Not sure though.
            self.packerwarning = True
        elif ":" in name and prefix == '':
            self.packerwarning = True
            embedded_prefix, new_name = name.split(":", 1)
            if embedded_prefix in self.axml.nsmap:
                log.info("Prefix '{}' is in namespace mapping, assume that it is a prefix.")
                prefix = self._print_namespace(self.axml.nsmap[embedded_prefix])
                name = new_name
            else:
                # Print out an extra warning
                log.warning("Confused: name contains a unknown namespace prefix: '{}'. "
                            "This is either a broken AXML file or some attempt to break stuff.".format(name))
        if not re.match(r"^[a-zA-Z0-9._-]*$", name):
            log.warning("Name '{}' contains invalid characters!".format(name))
            self.packerwarning = True
            name = re.sub(r"[^a-zA-Z0-9._-]", "_", name)

        return prefix, name