def extract_fcp_data(raw_data, status):
    """
    extract data from smcli System_WWPN_Query output.
    Input:
        raw data returned from smcli
    Output:
        data extracted would be like:
    'status:Free \n
     fcp_dev_no:1D2F\n
     physical_wwpn:C05076E9928051D1\n
     channel_path_id:8B\n
     npiv_wwpn': 'NONE'\n

     status:Free\n
     fcp_dev_no:1D29\n
     physical_wwpn:C05076E9928051D1\n
     channel_path_id:8B\n
     npiv_wwpn:NONE
    """
    raw_data = raw_data.split('\n')

    # clear blank lines
    data = []
    for i in raw_data:
        i = i.strip(' \n')
        if i == '':
            continue
        else:
            data.append(i)
    # process data into one list of dicts
    results = []
    for i in range(0, len(data), 5):
        temp = data[i + 1].split(':')[-1].strip()
        # only return results match the status
        if temp.lower() == status.lower():
            results.extend(data[i:i + 5])

    return '\n'.join(results)