The 'k' element appears to be kik's connection-related stanza.
        It lets us know if a connection or a login was successful or not.

        :param k_element: The XML element we just received from kik.
482999
def _handle_received_k_element(self, k_element: BeautifulSoup):
        
        if k_element['ok'] == "1":
            self.connected = True

            if 'ts' in k_element.attrs:
                # authenticated!
                log.info("[+] Authenticated successfully.")
                self.authenticated = True
                self.callback.on_authenticated()
            elif self.should_login_on_connection:
                self.login(self.username, self.password)
                self.should_login_on_connection = False
        else:
            self.callback.on_connection_failed(login.ConnectionFailedResponse(k_element))
8504
def referenced_element
      ref = @xml.attributes['ref'].value
      @referenced_element ||= if ref =~ /:/
        prefix, element = ref.split(':')
        schema.find_element(element) || schema.find_attribute("@#{element}") if schema = Schema.find(prefix)
      else
        self.schema.find_element(ref) || self.schema.find_attribute("@#{ref}")
      end
    end
1253514
def __mark(self, element, mark_set):
        
        try:
            # The given element can be of a different type than the original
            # one (JID instead of str, ...), so we retrieve the original one
            original = self.__elements.pop(element)
            mark_set.add(original)
        except KeyError:
            return False
        else:
            if not self.__elements:
                # No more elements to wait for
                self.__call()
            return True
835416
def check_element(self, elem, check_children=False, next_to_elem=None):
        
        self.__add_element('eid', elem.attribs, self.__element_ids, elem, next_to_elem)
        self.__add_element('aid', elem.attribs, self.__attrib_ids, elem, next_to_elem)
        self.__add_element('rid', elem.attribs, self.__repeat_ids, elem, next_to_elem)
        if check_children and elem.children:
            for child in elem.children:
                self.check_element(child, True, next_to_elem)
395366
def element_to_extension_element(element):
    

    exel = ExtensionElement(element.c_tag, element.c_namespace,
                            text=element.text)

    exel.attributes.update(element.extension_attributes)
    exel.children.extend(element.extension_elements)

    for xml_attribute, (member_name, typ, req) in \
            iter(element.c_attributes.items()):
        member_value = getattr(element, member_name)
        if member_value is not None:
            exel.attributes[xml_attribute] = member_value

    exel.children.extend([element_to_extension_element(c) for c in
                          element.children_with_values()])

    return exel
922368
def parse(parent_node)

    # run element parser
    begin
      parent_node.parser.matching_negative if negative
      match = parser.call(parent_node)
    ensure
      parent_node.parser.unmatching_negative if negative
    end

    # Negative patterns (PEG: !element)
    match = match ? nil : EmptyNode.new(parent_node) if negative

    # Optional patterns (PEG: element?)
    match = EmptyNode.new(parent_node) if !match && optional

    # Could-match patterns (PEG: &element)
    match.match_length = 0 if match && could_match

    if !match && (terminal || negative)
      # log failures on Terminal patterns for debug output if overall parse fails
      parent_node.parser.log_parsing_failure parent_node.next, :pattern => self.to_s, :node => parent_node
    end

    match.delimiter = delimiter if match

    # return match
    match
  end
139852
public void complete(Element e) throws KNXMLException
	{
		if (e.isEmptyElementTag())
			return;
		final int index = openElems.lastIndexOf(e.getName());
		if (index == -1)
			throw new KNXMLException("element tag not read before", e.getName(), line);
		String end = null;
		final StringBuffer content = new StringBuffer(50);
		while (canRead()) {
			// read text content
			final String s = read('<');
			final boolean current = openElems.peek().equals(e.getName());
			// if character data is for current element, append it
			if (current && s.length() > 0)
				content.append(References.replace(s, false));
			// read a possible end tag
			end = read('>');
			if (skipComment(end))
				;
			else if (current && readCDATASection(end, content))
				;
			else if (end.length() > 0 && end.charAt(0) == '/') {
				// actually, no white space is allowed between '/' and tag name
				// but there might be some between end of name and '>'
				final String tag = end.substring(1).trim();
				// got end tag?
				if (!tag.equals(openElems.peek()))
					throw new KNXMLException("element end tag does not match start tag",
						tag, line);
				openElems.pop();
				if (tag.equals(e.getName())) {
					e.setCharacterData(content.toString());
					pos = END_TAG;
					return;
				}
			}
			else if (end.length() > 0)
				// don't push empty element tags
				if (end.charAt(end.length() - 1) != '/') {
					final String tag = splitOnSpace(end);
					if (tag.length() > 0)
						openElems.push(tag);
				}
		}
		throw new KNXMLException("end of XML input with elements left open", end, line);
	}
1206009
def k(self, symbol='', begin=None, end=None):
        '''
        
        '''
        with self.client.connect(*self.bestip):
            data = self.client.get_k_data(symbol, begin, end)
            return data
1339521
def get_element_id(element):
        
        id_attrib_key = add_ns('id')
        if id_attrib_key in element.attrib:
            return element.attrib[id_attrib_key]
        try:
            return element.getparent().attrib[id_attrib_key]
        except KeyError as e:
            raise KeyError(
                'Neither the element "{0}" nor its parent "{1}" '
                'have an ID'.format(element, element.getparent()))
911324
def _element_get_id(self, element):
        
        if self._reader._level > 1:
            entry_id = element.get('id')
        else:
            entry_id = element.get('name')
        return entry_id
206494
def _parse_flags(element):
    
    visible = True if element.get('visible') else False
    user = element.get('user')
    timestamp = element.get('timestamp')
    if timestamp:
        timestamp = utils.Timestamp.parse_isoformat(timestamp)
    tags = {}
    try:
        for tag in element['tag']:
            key = tag.get('k')
            value = tag.get('v')
            tags[key] = value
    except AttributeError:
        pass

    return visible, user, timestamp, tags
1171630
def contains_element(self, element):
        
        return (element in self.element_finder) and \
            (self.element_finder[element][1] != self.INVALID)
740149
def kube_node_status_condition(self, metric, scraper_config):
        
        base_check_name = scraper_config['namespace'] + '.node'
        metric_name = scraper_config['namespace'] + '.nodes.by_condition'
        by_condition_counter = Counter()

        for sample in metric.samples:
            node_tag = self._label_to_tag("node", sample[self.SAMPLE_LABELS], scraper_config)
            self._condition_to_tag_check(
                sample,
                base_check_name,
                self.condition_to_status_positive,
                scraper_config,
                tags=[node_tag] + scraper_config['custom_tags'],
            )

            # Counts aggregated cluster-wide to avoid no-data issues on node churn,
            # node granularity available in the service checks
            tags = [
                self._label_to_tag("condition", sample[self.SAMPLE_LABELS], scraper_config),
                self._label_to_tag("status", sample[self.SAMPLE_LABELS], scraper_config),
            ] + scraper_config['custom_tags']
            by_condition_counter[tuple(sorted(tags))] += sample[self.SAMPLE_VALUE]

        for tags, count in iteritems(by_condition_counter):
            self.gauge(metric_name, count, tags=list(tags))
219969
def xml_compare(expected, found):
    

    # if comparing the same ET object
    if expected == found:
        return True

    # compare element attributes, ignoring order
    if set(expected.items()) != set(found.items()):
        return False

    # check for equal number of children
    expected_children = list(expected)
    found_children = list(found)
    if len(expected_children) != len(found_children):
        return False

    # compare children
    if not all([xml_compare(a, b) for a, b in zip(expected_children, found_children)]):
        return False

    # compare elements, if there is no text node, return True
    if (expected.text is None or expected.text.strip() == "") \
        and (found.text is None or found.text.strip() == ""):
        return True
    else:
        return expected.tag == found.tag and expected.text == found.text \
            and expected.attrib == found.attrib
229662
def xml(self):
        
        root = Element('UsernameToken', ns=wssens)
        u = Element('Username', ns=wssens)
        u.setText(self.username)
        root.append(u)
        p = Element('Password', ns=wssens)
        p.setText(self.password)
        if self.password_digest:
            p.set("Type", wsdigest)
            p.setText(self.password_digest)
        root.append(p)
        if self.nonce is not None:
            n = Element('Nonce', ns=wssens)
            if self.nonce_has_encoding:
                n.set("EncodingType", nonce_encoding_type)
            n.setText(self.nonce)
            root.append(n)
        if self.created is not None:
            n = Element('Created', ns=wsuns)
            n.setText(str(DateTime(self.created)))
            root.append(n)
        return root
1149533
def element(self):
        
        element = self.keywords["VRHFIN"].split(":")[0].strip()
        try:
            return Element(element).symbol
        except ValueError:
            # VASP incorrectly gives the element symbol for Xe as "X"
            # Some potentials, e.g., Zr_sv, gives the symbol as r.
            if element == "X":
                return "Xe"
            return Element(self.symbol.split("_")[0]).symbol
1188201
function (element) {
		if (element) {
			if (element.metaClassName() === 'org.kevoree.ComponentInstance') {
				// if parent is this node platform: it's ok
				return (element.eContainer().name === this.node.getName());

			} else if (element.metaClassName() === 'org.kevoree.Channel') {
				// if this channel has bindings with components hosted in this node platform: it's ok
				var bindings = element.bindings.iterator();
				while (bindings.hasNext()) {
					var binding = bindings.next();
					if (binding.port && binding.port.eContainer()) {
						if (this.isRelatedToPlatform(binding.port.eContainer())) {
							return true;
						}
					}
				}

			} else if (element.metaClassName() === 'org.kevoree.Group') {
				return element.subNodes.array.some(function (node) {
					return this.isRelatedToPlatform(node);
				}.bind(this));

			} else if (element.metaClassName() === 'org.kevoree.ContainerNode') {
				return ((element.name === this.node.getName()) || (element.host && element.host.name === this.node.getName()));

			} else if (element.metaClassName() === 'org.kevoree.MBinding') {
				if (element.port && element.port.eContainer()) {
					if (this.isRelatedToPlatform(element.port.eContainer())) {
						return true;
					}
				}
				if (element.hub) {
					return this.isRelatedToPlatform(element.hub);
				}

			} else if (element.metaClassName() === 'org.kevoree.Value') {
				if (element.eContainer().metaClassName() === 'org.kevoree.FragmentDictionary') {
					return (element.eContainer().name === this.node.getName());
				} else {
					return this.isRelatedToPlatform(element.eContainer().eContainer());
				}

			} else if (element.metaClassName() === 'org.kevoree.Port') {
				return this.isRelatedToPlatform(element.eContainer());
			}
		}
		return false;
	}