def build_endpoint(route, target=None):
    """Build a REST endpoint string by joining route and target.

    Args:
        route (:obj:`str`):
            Route part of endpoint.
        target (:obj:`str`, optional):
            Target part of endpoint.

            Defaults to None.

    Returns:
        :obj:`str`

    """
    target = "" if target is None else "/{}".format(target)
    return "{}{}".format(route, target)