def METHOD_NAME(existed=True, inactive=False):
    """
    Check VM xml file to validate whether serial and console elements exists.
    :param existed: Default is True indicate whether element exist or not
    :param inactive: indicate VM xml is from active or inactive VM.
    """
    # Get current serial and console XML
    current_xml = VMXML.new_from_dumpxml(vm_name)
    if inactive:
        current_xml = VMXML.new_from_inactive_dumpxml(vm_name)
    serial_elem = current_xml.xmltreefile.find('devices/serial')
    console_elem = current_xml.xmltreefile.find('devices/console')
    if existed:
        if serial_elem is None:
            test.fail("Expect generate serial"
                      "but found none.")
        if target_type != 'pci-serial' and console_elem is None:
            test.fail("Expect generate console automatically, "
                      "but found none.")