Get proxy from an elt.

    If elt implements the proxy generator method (named ``__getproxy__``), use
    it instead of using this module functions.

    :param elt: elt to proxify.
    :type elt: object or function/method
    :param bases: base types to enrich in the result cls if not None.
    :param _dict: class members to proxify if not None.

def get_proxy(elt, bases=None, _dict=None):
    """Get proxy from an elt.

    If elt implements the proxy generator method (named ``__getproxy__``), use
    it instead of using this module functions.

    :param elt: elt to proxify.
    :type elt: object or function/method
    :param bases: base types to enrich in the result cls if not None.
    :param _dict: class members to proxify if not None.
    """

    # try to find an instance proxy generator
    proxygenerator = getattr(elt, __GETPROXY__, None)

    # if a proxy generator is not found, use this module
    if proxygenerator is None:
        if isroutine(elt):
            result = proxify_routine(elt)

        else:  # in case of object, result is a Proxy
            result = proxify_elt(elt, bases=bases, _dict=_dict)

    else:  # otherwise, use the specific proxy generator
        result = proxygenerator()

    return result