'find a VLUN on a 3PAR host.'

def _get_vlun(self, volume_name, hostname, lun_id=None, nsp=None):

    vluns = self.client.getHostVLUNs(hostname)
    found_vlun = None
    for vlun in vluns:
        if (volume_name in vlun['volumeName']):
            if (lun_id is not None):
                if (vlun['lun'] == lun_id):
                    if nsp:
                        port = self.build_portPos(nsp)
                        if (vlun['portPos'] == port):
                            found_vlun = vlun
                            break
                    else:
                        found_vlun = vlun
                        break
            else:
                found_vlun = vlun
                break
    if (found_vlun is None):
        LOG.info('3PAR    vlun    %(name)s    not    found    on    host    %(host)s', {'name': volume_name, 'host': hostname})
    return found_vlun
