Check if string could be a valid python identifier

    :param string: string to be tested
    :returns: True if string can be a python identifier, False otherwise
    :rtype: bool
165775
def is_identifier(string):
    
    matched = PYTHON_IDENTIFIER_RE.match(string)
    return bool(matched) and not keyword.iskeyword(string)
624315
def _ensure_unicode_string(string):
        
        if not isinstance(string, six.text_type):
            string = string.decode('utf-8')
        return string
1038993
def id?(str)
      token = @tokens[@p]
      return false unless token && token[0] == :id
      return false unless token[1] == str
      @p += 1
      token[1]
    end
603313
def message_identification=(value)
      raise ArgumentError.new('message_identification must be a string!') unless value.is_a?(String)

      regex = /\A([A-Za-z0-9]|[\+|\?|\/|\-|\:|\(|\)|\.|\,|\'|\ ]){1,35}\z/
      raise ArgumentError.new("message_identification does not match #{regex}!") unless value.match(regex)

      @message_identification = value
    end
855112
def is_valid(self):
        
        if not self.text:
            return False

        try:
            pysrt.from_string(self.text, error_handling=pysrt.ERROR_RAISE)
        except pysrt.Error as e:
            if e.args[0] < 80:
                return False

        return True
876817
def is_bytes(string):
    
    if six.PY3 and isinstance(string, (bytes, memoryview, bytearray)):  # noqa
        return True
    elif six.PY2 and isinstance(string, (buffer, bytearray)):  # noqa
        return True
    return False
1263215
def validate(self, value):
        
        val = value
        if isinstance(val, str):
            #FIXME: unsafe decoding
            val = unicode(value)
        val = super(String, self).validate(val)
        if not isinstance(val, unicode):
            raise ValueError("Not a string: %r" % (value, ))
        return val
305741
def is_special_string(obj):
        """"""

        import bs4
        return isinstance(obj, (bs4.Comment, bs4.Declaration, bs4.CData, bs4.ProcessingInstruction))
1348855
def is_string(val):
    """"""
    try:
        basestring
    except NameError:
        return isinstance(val, str)
    return isinstance(val, basestring)
60659
private static boolean isValidIdentifier(String identifier) {
    if (identifier.isEmpty()) {
      return false;
    }

    char first = identifier.charAt(0);
    if (first != '_' && (first < 'a' || first > 'z') && (first < 'A' || first > 'Z')) {
      return false;
    }
    for (int i = 1; i < identifier.length(); i++) {
      char c = identifier.charAt(i);
      if (c != '_' && (c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9')) {
        return false;
      }
    }
    return true;
  }
1346583
function checkIdentifier(str, context) {
    if (!/^[a-zA-Z_][a-zA-Z_0-9]*$/.test(str)) {
        throw new ImplementationError(`Invalid identifier "${str}"${context.errorContext}`);
    }
    return str;
}
202044
def unicode_is_ascii(u_string):
    
    assert isinstance(u_string, str)
    try:
        u_string.encode('ascii')
        return True
    except UnicodeEncodeError:
        return False
1038404
def check_is_uuid(self, uuid_str: str):
        
        # check uuid type
        if not isinstance(uuid_str, str):
            raise TypeError("'uuid_str' expected a str value.")
        else:
            pass
        # handle Isogeo specific UUID in XML exports
        if "isogeo:metadata" in uuid_str:
            uuid_str = "urn:uuid:{}".format(uuid_str.split(":")[-1])
        else:
            pass
        # test it
        try:
            uid = UUID(uuid_str)
            return uid.hex == uuid_str.replace("-", "").replace("urn:uuid:", "")
        except ValueError as e:
            logging.error(
                "uuid ValueError. {} ({})  -- {}".format(type(uuid_str), uuid_str, e)
            )
            return False
787422
def is_print(value, space = True, tab = False, crlf = False):
    
    if not isinstance(value, basestring):
        return False

    regex = r'\x00-\x08\x0B\x0C\x0E-\x1F\x7F'

    if not space:
        regex += r'\x20'

    if tab:
        regex += r'\x09'

    if crlf:
        regex += r'\x0A\x0D'

    return re.match(r'[' + regex + ']', value, re.U) is None
925079
def is_valid_uid(uid):
    
    pattern = r'^[A-Za-z][A-Za-z0-9]{10}$'
    if not isinstance(uid, string_types):
        return False
    return bool(re.compile(pattern).match(uid))
296451
def _is_json(string):
        
        try:
            if isinstance(string, bytes):
                json_str = json.loads(string.decode("utf-8"), object_pairs_hook=OrderedDict)
            elif isinstance(string, str):
                json_str = json.loads(string, object_pairs_hook=OrderedDict)
            else:
                raise TypeError("Expecting <class 'str'> or <class 'bytes'>, but {} was passed".format(type(string)))
            return json_str
        except ValueError:
            return False
494333
private static boolean isAsciiAlphaNum(String string) {
        for (int i = 0; i < string.length(); i++) {
            final char character = string.charAt(i);
            if (!(character >= 'a' && character <= 'z' ||
                    character >= 'A' && character <= 'Z' ||
                    character >= '0' && character <= '9')) {
                return false;
            }
        }

        return true;
    }