import re


def _parse_trailers(text: str) -> str:
    """Parses and returns trailers in the text.

    Arguments:
        text {str} -- commit body text with trailers

    Returns:
        str -- the trailer lines.
    """
    lines = text.splitlines()
    trailer = re.compile(r"\s*(Source-Link:|PiperOrigin-RevId:).*")
    return "\n".join([line for line in lines if trailer.match(line)])