<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_host_mapping(host_id, nexus_ip, interface, ch_grp, is_static):
 """Add Host to interface mapping entry into mapping data base. :param host_id: is the name of the host to add :param interface: is the interface for this host :param nexus_ip: is the ip addr of the nexus switch for this interface :param ch_grp: is the port channel this interface belos :param is_static: whether this is from conf file or learned from baremetal. """


    LOG.debug("add_nexusport_binding() called")
    session = bc.get_writer_session()
    mapping = nexus_models_v2.NexusHostMapping(host_id=host_id,
                  if_id=interface,
                  switch_ip=nexus_ip,
                  ch_grp=ch_grp,
                  is_static=is_static)
    try:
        session.add(mapping)
        session.flush()
    except db_exc.DBDuplicateEntry:
        with excutils.save_and_reraise_exception() as ctxt:
            if is_static:
                ctxt.reraise = False
                LOG.debug("Duplicate static entry encountered "
                          "host=%(host)s, if=%(if)s, ip=%(ip)s",
                          {'host': host_id, 'if': interface,
                           'ip': nexus_ip})

    return mapping