<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_receiver_sources(self):
 """ Get sources list from receiver. Internal method which queries device via HTTP to get the receiver's input sources. This method also determines the type of the receiver (avr, avr-x, avr-x-2016). """

        # Test if receiver is a AVR-X with port 80 for pre 2016 devices and
        # port 8080 devices 2016 and later
        r_types = [AVR_X, AVR_X_2016]
        for r_type, port in r_types:
            self._receiver_port = port

            # This XML is needed to get the sources of the receiver
            try:
                root = self.get_status_xml(self._urls.deviceinfo,
                                           suppress_errors=True)
            except (ValueError, requests.exceptions.RequestException):
                self._receiver_type = None
            else:
                # First test by CommApiVers
                try:
                    if bool(DEVICEINFO_COMMAPI_PATTERN.search(
                            root.find("CommApiVers").text) is not None):
                        self._receiver_type = r_type
                        # receiver found break the loop
                        break
                except AttributeError:
                    # AttributeError occurs when ModelName tag is not found.
                    # In this case there is no AVR-X device
                    self._receiver_type = None

                # if first test did not find AVR-X device, check by model name
                if self._receiver_type is None:
                    try:
                        if bool(DEVICEINFO_AVR_X_PATTERN.search(
                                root.find("ModelName").text) is not None):
                            self._receiver_type = r_type
                            # receiver found break the loop
                            break
                    except AttributeError:
                        # AttributeError occurs when ModelName tag is not found
                        # In this case there is no AVR-X device
                        self._receiver_type = None

        # Set ports and update method
        if self._receiver_type is None:
            self._receiver_type = AVR.type
            self._receiver_port = AVR.port
        elif self._receiver_type == AVR_X_2016.type:
            self._receiver_port = AVR_X_2016.port
        else:
            self._receiver_port = AVR_X.port

        _LOGGER.info("Identified receiver type: '%s' on port: '%s'",
                     self._receiver_type, self._receiver_port)

        # Not an AVR-X device, start determination of sources
        if self._receiver_type == AVR.type:
            # Sources list is equal to list of renamed sources.
            non_x_sources, deleted_non_x_sources, status_success = (
                self._get_renamed_deleted_sourcesapp())

            # Backup if previous try with AppCommand was not successful
            if not status_success:
                non_x_sources, deleted_non_x_sources = (
                    self._get_renamed_deleted_sources())

            # Remove all deleted sources
            if self._show_all_inputs is False:
                for deleted_source in deleted_non_x_sources.items():
                    if deleted_source[1] == "DEL":
                        non_x_sources.pop(deleted_source[0], None)
            # Invalid source "SOURCE" needs to be deleted
            non_x_sources.pop("SOURCE", None)
            return non_x_sources

        # Following source determination of AVR-X receivers
        else:
            # receiver_sources is of type dict with "FuncName" as key and
            # "DefaultName" as value.
            receiver_sources = {}
            # Source determination from XML
            favorites = root.find(".//FavoriteStation")
            if favorites:
                for child in favorites:
                    if not child.tag.startswith("Favorite"):
                        continue
                    func_name = child.tag.upper()
                    self._favorite_func_list.append(func_name)
                    receiver_sources[func_name] = child.find("Name").text
            for xml_zonecapa in root.findall("DeviceZoneCapabilities"):
                # Currently only Main Zone (No=0) supported
                if xml_zonecapa.find("./Zone/No").text == "0":
                    # Get list of all input sources of receiver
                    xml_list = xml_zonecapa.find("./InputSource/List")
                    for xml_source in xml_list.findall("Source"):
                        receiver_sources[
                            xml_source.find(
                                "FuncName").text] = xml_source.find(
                                    "DefaultName").text

            return receiver_sources