<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_records_safely_by_xml_id(env, xml_ids):
 """This removes in the safest possible way the records whose XML-IDs are passed as argument. :param xml_ids: List of XML-ID string identifiers of the records to remove. """

    for xml_id in xml_ids:
        logger.debug('Deleting record for XML-ID %s', xml_id)
        try:
            with env.cr.savepoint():
                env.ref(xml_id).exists().unlink()
        except Exception as e:
            logger.error('Error deleting XML-ID %s: %s', xml_id, repr(e))