Return information about a relay.

        :param relay: The relay being queried.
        :type relay: int
        :param attribute: The attribute being queried, or all attributes for
                          that relay if None is specified.
        :type attribute: string or None
        :returns: The attribute being queried or None if not found.
        :rtype: string or int

def relay_info(self, relay, attribute=None):
        """
        Return information about a relay.

        :param relay: The relay being queried.
        :type relay: int
        :param attribute: The attribute being queried, or all attributes for
                          that relay if None is specified.
        :type attribute: string or None
        :returns: The attribute being queried or None if not found.
        :rtype: string or int
        """

        # Check if the relay number is valid.
        if (relay < 0) or (relay > (self.num_relays - 1)):
            # Invalid relay index specified.
            return None
        else:
            if attribute is None:
                # Return all the relay attributes.
                return self.relays[relay]
            else:
                try:
                    return self.relays[relay][attribute]
                except KeyError:
                    # Invalid key specified.
                    return None