Format the preconditions and postconditions of a function given its checker decorator.

    :param func: function whose contracts we are describing
    :param prefix: prefix to be prepended to the contract directives such as ``get`` or ``set``
    :return: list of lines

def _format_function_contracts(func: Callable, prefix: Optional[str] = None) -> List[str]:
    """
    Format the preconditions and postconditions of a function given its checker decorator.

    :param func: function whose contracts we are describing
    :param prefix: prefix to be prepended to the contract directives such as ``get`` or ``set``
    :return: list of lines
    """
    checker = icontract._checkers.find_checker(func=func)
    if checker is None:
        return []

    pps = _preconditions_snapshots_postconditions(checker=checker)

    pre_block = _format_preconditions(preconditions=pps.preconditions, prefix=prefix)
    old_block = _format_snapshots(snapshots=pps.snapshots, prefix=prefix)
    post_block = _format_postconditions(postconditions=pps.postconditions, prefix=prefix)

    return pre_block + old_block + post_block