summaryrefslogtreecommitdiff
path: root/macaroonbakery/checkers/utils.py
blob: 925e8c78684f3c6a1448ee7cd2c58d2a00951dda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.


def condition_with_prefix(prefix, condition):
    '''Returns the given string prefixed by the given prefix.

    If the prefix is non-empty, a colon is used to separate them.
    '''
    if prefix == '' or prefix is None:
        return condition

    return prefix + ':' + condition