'Convert ``elem`` into the internal representation.
This method is called implicitly whenever computations involve elements
not in the internal representation.
>>> from sympy.abc import x
>>> from sympy import QQ
>>> F = QQ.old_poly_ring(x).free_module(2)
>>> F.convert([1, 0])
[1, 0]'

def convert(self, elem, M=None):

    if isinstance(elem, FreeModuleElement):
        if (elem.module is self):
            return elem
        if (elem.module.rank != self.rank):
            raise CoercionFailed
        return FreeModuleElement(self, tuple((self.ring.convert(x, elem.module.ring) for x in elem.data)))
    elif iterable(elem):
        tpl = tuple((self.ring.convert(x) for x in elem))
        if (len(tpl) != self.rank):
            raise CoercionFailed
        return FreeModuleElement(self, tpl)
    elif (elem is 0):
        return FreeModuleElement(self, ((self.ring.convert(0),) * self.rank))
    else:
        raise CoercionFailed
