from typing import OrderedDict


def build_pathrule(path, serviceUrl):
    """
    This method builds and returns a host rule ordered dict, suitable for appending to a pathMatcher object.
    Parameters:
    path: The absolute or wildcard path to match against (currently only a single path is supported).
    serviceUrl: The service i.e., backend bucket where requests that match the path should be sent.
    """
    rule = OrderedDict()
    rule['paths'] = [path]
    rule['routeAction'] = OrderedDict()
    rule['routeAction']['urlRewrite'] = OrderedDict()
    rule['routeAction']['urlRewrite']['pathPrefixRewrite'] = '/'
    rule['service'] = serviceUrl
    return rule