import os def retrieve_secrets( file_path: str | os.PathLike, secret_from: str, access_type: str="default" ) -> str: with open(file_path, 'r') as file: lines = file.read().split('\n\n') for block in lines: if secret_from in block: tokens = block.split('\n') for token in tokens: if token.startswith('#'): continue token_parts = token.split('#') token_value = token_parts[0].strip() token_type = token_parts[1].strip() if len(token_parts) > 1 else 'default' if token_type == access_type: return token_value return None