def METHOD_NAME(s, dotted=False, prefix=False):
    """
    Return whether ``s`` is a valid Python identifier name.
      >>> is_identifier("foo")
      True
      >>> is_identifier("foo+bar")
      False
      >>> is_identifier("from")
      False
    By default, we check whether ``s`` is a single valid identifier, meaning
    dots are not allowed.  If ``dotted=True``, then we check each dotted
    component::
      >>> is_identifier("foo.bar")
      False
      >>> is_identifier("foo.bar", dotted=True)
      True
      >>> is_identifier("foo..bar", dotted=True)
      False
      >>> is_identifier("foo.from", dotted=True)
      False
    By default, the string must comprise a valid identifier.  If
    ``prefix=True``, then allow strings that are prefixes of valid identifiers.
    Prefix=False excludes the empty string, strings with a trailing dot, and
    strings with a trailing keyword component, but prefix=True does not
    exclude these.
      >>> is_identifier("foo.bar.", dotted=True)
      False
      >>> is_identifier("foo.bar.", dotted=True, prefix=True)
      True
      >>> is_identifier("foo.or", dotted=True)
      False
      >>> is_identifier("foo.or", dotted=True, prefix=True)
      True
    :type s:
      ``str``
    :param dotted:
      If ``False`` (default), then the input must be a single name such as
      "foo".  If ``True``, then the input can be a single name or a dotted name
      such as "foo.bar.baz".
    :param prefix:
      If ``False`` (Default), then the input must be a valid identifier.  If
      ``True``, then the input can be a valid identifier or the prefix of a
      valid identifier.
    :rtype:
      ``bool``
    """
    if not isinstance(s, six.string_types):
        raise TypeError("is_identifier(): expected a string; got a %s"
                        % (type(s).__name__,))
    if prefix:
        return METHOD_NAME(s + '_', dotted=dotted, prefix=False)
    if dotted:
        return all(METHOD_NAME(w, dotted=False) for w in s.split('.'))
    return s.isidentifier() and not _my_iskeyword(s)