def METHOD_NAME(space: str, from_spaces: List[str]) -> bool:
    if from_spaces == 'any': # TODO: This is a little bit hacky
        return True
    from_spaces = set(from_spaces)
    if space in from_spaces:
        return True
    elif space == 'cuda_host':
        return 'system' in from_spaces
    elif space == 'cuda_managed':
        return 'system' in from_spaces or 'cuda' in from_spaces
    else:
        return False