def get(iterable, **attrs):
def predicate(elem):<EOL><INDENT>for attr, val in attrs.items():<EOL><INDENT>nested = attr.split('<STR_LIT>')<EOL>obj = elem<EOL>for attribute in nested:<EOL><INDENT>obj = getattr(obj, attribute)<EOL><DEDENT>if obj != val:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>return find(predicate, iterable)<EOL>
r"""A helper that returns the first element in the iterable that meets
    all the traits passed in ``attrs``. This is an alternative for
    :func:`discord.utils.find`.

    When multiple attributes are specified, they are checked using
    logical AND, not logical OR. Meaning they have to meet every
    attribute passed in and not one of them.

    To have a nested attribute search (i.e. search by ``x.y``) then
    pass in ``x__y`` as the keyword argument.

    If nothing is found that matches the attributes passed, then
    ``None`` is returned.

    Examples
    ---------

    Basic usage:

    .. code-block:: python3

        member = discord.utils.get(message.guild.members, name='Foo')

    Multiple attribute matching:

    .. code-block:: python3

        channel = discord.utils.get(guild.voice_channels, name='Foo', bitrate=64000)

    Nested attribute matching:

    .. code-block:: python3

        channel = discord.utils.get(client.get_all_channels(), guild__name='Cool', name='general')

    Parameters
    -----------
    iterable
        An iterable to search through.
    \*\*attrs
        Keyword arguments that denote attributes to search with.