def init_backend(limit=None):
<EOL>backend._limit = limit<EOL>keyrings = filter(limit, backend.get_all_keyring())<EOL>set_keyring(<EOL>load_env()<EOL>or load_config()<EOL>or max(keyrings, default=fail.Keyring(), key=backend.by_priority)<EOL>)<EOL>
Load a keyring specified in the config file or infer the best available.

Limit, if supplied, should be a callable taking a backend and returning
True if that backend should be included for consideration.