Python version independent function to check if a typing.Tuple object
    contains an ellipsis.
518678
def is_Tuple_ellipsis(tpl):
    """"""
    try:
        return tpl.__tuple_use_ellipsis__
    except AttributeError:
        try:
            if tpl.__args__ is None:
                return False
            # Python 3.6
            if tpl.__args__[-1] is Ellipsis:
                return True
        except AttributeError:
            pass
        return False
383685
def _isstring(dtype):
    
    return dtype.type == numpy.unicode_ or dtype.type == numpy.string_
936372
def is_tuple_end(self, extra_end_rules=None):
        """"""
        if self.stream.current.type in ('variable_end', 'block_end', 'rparen'):
            return True
        elif extra_end_rules is not None:
            return self.stream.current.test_any(extra_end_rules)
        return False
125170
def isseq(obj):
  '''
  
  '''
  return \
    not isstr(obj) \
    and not isdict(obj) \
    and ( isinstance(obj, (list, tuple)) \
          or callable(getattr(obj, '__iter__', None)))
1205113
def ensure_tuple(tuple_or_mixed, *, cls=None):
    
    if cls is None:
        cls = tuple

    if isinstance(tuple_or_mixed, cls):
        return tuple_or_mixed

    if tuple_or_mixed is None:
        return tuple.__new__(cls, ())

    if isinstance(tuple_or_mixed, tuple):
        return tuple.__new__(cls, tuple_or_mixed)

    return tuple.__new__(cls, (tuple_or_mixed,))
468639
def _ensure_ifaces_tuple(ifaces):
    """"""
    try:

        ifaces = tuple(ifaces)

    except TypeError:

        ifaces = (ifaces,)

    for iface in ifaces:

        if not _issubclass(iface, ibc.Iface):

            raise TypeError('Can only compare against interfaces.')

    return ifaces
83145
def visit_tuple(self, node):
        """"""
        if len(node.elts) == 1:
            return "(%s, )" % node.elts[0].accept(self)
        return "(%s)" % ", ".join(child.accept(self) for child in node.elts)
1167847
def make_type_consistent(s1, s2):
    """"""
    if isinstance(s1, str) and isinstance(s2, str):
        return s1, s2

    elif isinstance(s1, unicode) and isinstance(s2, unicode):
        return s1, s2

    else:
        return unicode(s1), unicode(s2)
755321
def is_tuple(obj, len_=None):
    
    if not isinstance(obj, tuple):
        return False

    if len_ is None:
        return True
    if not isinstance(len_, Integral):
        raise TypeError(
            "length must be a number (got %s instead)" % type(len_).__name__)
    if len_ < 0:
        raise ValueError("length must be positive (got %s instead)" % len_)

    return len(obj) == len_
275718
def ismatch(self, s):
        
        if self._ismatchfun(s) and self._compiled_pattern.match(s):
            return True
        return False
1171605
function isType(o, typeName) {
        if (!o || !_.isObject(o)) {
            return false;
        }
        try {
            return Tinkerpop.Java.instanceOf(o, typeName);
        }
        catch (err) {
            return false;
        }
    }
883643
def _parse_local_version(local):
    
    if local is not None:
        return tuple(
            part.lower() if not part.isdigit() else int(part)
            for part in _local_version_separators.split(local)
        )
43432
def _parse_tuple_string(argument):
        
        if isinstance(argument, str):
            return tuple(int(p.strip()) for p in argument.split(','))
        return argument
754428
def is_regex_type(type_):
    

    return (
        callable(type_)
        and getattr(type_, "__name__", None) == REGEX_TYPE_NAME
        and hasattr(type_, "__supertype__")
        and is_compiled_pattern(type_.__supertype__)
    )
500911
def check_py(self, version, name, original, loc, tokens):
        """"""
        internal_assert(len(tokens) == 1, "invalid " + name + " tokens", tokens)
        if self.target_info < get_target_info(version):
            raise self.make_err(CoconutTargetError, "found Python " + ".".join(version) + " " + name, original, loc, target=version)
        else:
            return tokens[0]
1052074
def normalize_type(type_, level=0):
    
    if not typing or not isinstance(type_, typing.TypingMeta) or type_ is AnyType:
        return type_
    if isinstance(type_, typing.TypeVar):
        if type_.__constraints__ or type_.__bound__:
            return type_
        else:
            return AnyType
    if issubclass(type_, typing.Union):
        if not type_.__union_params__:
            raise OverloadingError("typing.Union must be parameterized")
        return typing.Union[tuple(normalize_type(t, level) for t in type_.__union_params__)]
    if issubclass(type_, typing.Tuple):
        params = type_.__tuple_params__
        if level > 0 or params is None:
            return typing.Tuple
        elif type_.__tuple_use_ellipsis__:
            return typing.Tuple[normalize_type(params[0], level + 1), ...]
        else:
            return typing.Tuple[tuple(normalize_type(t, level + 1) for t in params)]
    if issubclass(type_, typing.Callable):
        return typing.Callable
    if isinstance(type_, typing.GenericMeta):
        base = find_base_generic(type_)
        if base is typing.Generic:
            return type_
        else:
            return GenericWrapper(type_, base, level > 0)
    raise OverloadingError("%r not supported yet" % type_)
1077742
def visit_ellipsis(self, node, parent):
        """"""
        return nodes.Ellipsis(
            getattr(node, "lineno", None), getattr(node, "col_offset", None), parent
        )