def get_portfolio_from_href(href: list, file_type: str):
    """
    This function finds the protfolio code contained within a href for a given file_type

    Parameters
    ----------
    href : list
        list of hrefs from LUSID response
    file_type : str

    Returns
    -------
    list
        portfolio codes taken from hrefs
    """

    # get portfolio codes from each href
    codes = [j[-2] for j in [i.split("/") for i in href]]

    return codes