def wants_metadata(request):
    """
    Determine if a client request wants metadata to be included in the response.

    This method checks to see if an incoming request has an Accept header with
    the 'metadata=true' qualified attached to the MIME-type.

    :param request: HTTPServerRequest or equivalent from client
    :return boolean, True if metadata is requested.
    """
    wants_metadata = False

    if "Accept" in request.headers:
        accept_elems = request.headers["Accept"].split(';')
        if len(accept_elems) > 1:
            for elem in accept_elems[1:]:
                if '=' in elem:
                    elem = elem.split('=')
                    if elem[0].strip() == "metadata":
                        wants_metadata = str(elem[1]).strip().lower() == 'true'

    return wants_metadata