from re import search


def _find_cover_image(body):
    """Attempts to find a cover image to use for a summarized blog post.

    The cover image will be the first image found in the specified body.
    Because the body is written in markdown format, the algorithm works by
    looking for the pattern "![<label>](<URL>)" where <label> is an image
    label and <URL> is the URL to the image. If an occurrence of the
    aforementioned pattern is found, <URL> is returned.

    Args:
        body (str): A blog post's body.

    Returns:
        str | None: A URL to an image if successful, None otherwise.
    """

    result = None
    match = search("!\[.*\]\((.*)\)", body)
    if match:
        result = match.group(1)

    return result