from typing import List


def _filter_ibd_files(search_space: List[str], ibd_files: List[str]) -> List[str]:
    """Function that will filter the ibd_files list to include only those files which match the chromosomes in the search space
    
    Parameters
    
    search_space : List[str]
        list of chromosomes to filter the ibd files down to
        
    ibd_files : List[str]
        list of ibd files
        
    Returns
    
    List[str]
        returns a list of the files that include the chromosome numbers
    """
    # add a . to the end of the search space substrings so that the files are correctly identified. Ex:
    # substring will be chr1. which will prevent the function from returning both chr1 and chr10 as a match
    substrings: List[str] = [chr_num + "." for chr_num in search_space]

    # filter the ibd files if any of the substrings match the files
    return [file for file in ibd_files if any(substring in file for substring in substrings)]