<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def prepare_xml_read(data, objectify=False):
 """Prepare various input types for XML parsing. Args: data (iter):
 Data to read objectify (bool):
 Parse using lxml's objectify data binding Returns: etree.ElementTree: Tree suitable for parsing Raises: TypeError: Invalid value for data """

    mod = _objectify if objectify else etree
    if hasattr(data, 'readlines'):
        data = mod.parse(data).getroot()
    elif isinstance(data, list):
        data = mod.fromstring(''.join(data))
    elif isinstance(data, basestring):
        data = mod.parse(open(data)).getroot()
    else:
        raise TypeError('Unable to handle data of type %r' % type(data))
    return data