key: a function (backend -> bool) signaling if the backend 
         is suitable for a specific task

    example
    =======

    # Get available backends which can read in chunks
    >>> backend = _getBackend('file.flac', key=lambda backend:backend.can_read_chunked)

def _getBackend(path=None, key=None):
    """
    key: a function (backend -> bool) signaling if the backend 
         is suitable for a specific task

    example
    =======

    # Get available backends which can read in chunks
    >>> backend = _getBackend('file.flac', key=lambda backend:backend.can_read_chunked)
    """
    ext = _os.path.splitext(path)[1].lower() if path else None
    backends = _getBackends()
    if key:
        backends = [b for b in backends if key(b)]
    if ext:
        backends = [b for b in backends if ext in b.filetypes]
    if backends:
        return min(backends, key=lambda backend: backend.priority)
    return None