Get mac address from host record.

    Use `allow_array` to return possible multiple values.

    CLI Example:

    .. code-block:: bash

        salt-call infoblox.get_host_mac host=localhost.domain.com

def get_host_mac(name=None, allow_array=False, **api_opts):
    '''
    Get mac address from host record.

    Use `allow_array` to return possible multiple values.

    CLI Example:

    .. code-block:: bash

        salt-call infoblox.get_host_mac host=localhost.domain.com
    '''
    data = get_host(name=name, **api_opts)
    if data and 'ipv4addrs' in data:
        l = []
        for a in data['ipv4addrs']:
            if 'mac' in a:
                l.append(a['mac'])
        if allow_array:
            return l
        if l:
            return l[0]
    return None