def _lookup_host_mappings(query_type, session=None, **bfilter):
if session is None:<EOL><INDENT>session = bc.get_reader_session()<EOL><DEDENT>query_method = getattr(session.query(<EOL>nexus_models_v2.NexusHostMapping).filter_by(**bfilter), query_type)<EOL>try:<EOL><INDENT>mappings = query_method()<EOL>if mappings:<EOL><INDENT>return mappings<EOL><DEDENT><DEDENT>except sa_exc.NoResultFound:<EOL><INDENT>pass<EOL><DEDENT>raise c_exc.NexusHostMappingNotFound(**bfilter)<EOL>
Look up 'query_type' Nexus mappings matching the filter.

    :param query_type: 'all', 'one' or 'first'
    :param session: db session
    :param bfilter: filter for mappings query
    :returns: mappings if query gave a result, else
             raise NexusHostMappingNotFound.