'Convert input IPython source into valid Python.'

def ip2py(self, source):

    block = _ip.input_transformer_manager.transform_cell(source)
    if (len(block.splitlines()) == 1):
        return _ip.prefilter(block)
    else:
        return block
