'get the converter interface instance for x, or None'

def get_converter(self, x):

    if (not len(self)):
        return None
    converter = None
    classx = getattr(x, u'__class__', None)
    if (classx is not None):
        converter = self.get(classx)
    if (isinstance(x, np.ndarray) and x.size):
        xravel = x.ravel()
        try:
            if (not np.all(xravel.mask)):
                converter = self.get_converter(xravel[np.argmin(xravel.mask)])
                return converter
        except AttributeError:
            next_item = xravel[0]
            if ((not isinstance(next_item, np.ndarray)) or (next_item.shape != x.shape)):
                converter = self.get_converter(next_item)
            return converter
    if (converter is None):
        try:
            thisx = safe_first_element(x)
        except (TypeError, StopIteration):
            pass
        else:
            if (classx and (classx != getattr(thisx, u'__class__', None))):
                converter = self.get_converter(thisx)
                return converter
    return converter
