Find and return any CloudFront distributions which happen to have a Comment sub-field
    either exactly matching the given Comment, or beginning with it AND with the remainder
    separated by a colon.

    Comment
        The string to be matched when searching for the given Distribution.  Note that this
        will be matched against both the exact value of the Comment sub-field, AND as a
        colon-separated initial value for the same Comment sub-field.  E.g. given a passed
        `Comment` value of `foobar`, this would match a distribution with EITHER a
        Comment sub-field of exactly `foobar`, OR a Comment sub-field beginning with
        `foobar:`.  The intention here is to permit using the Comment field for storing
        actual comments, in addition to overloading it to store Salt's `Name` attribute.

    region
        Region to connect to.

    key
        Secret key to use.

    keyid
        Access key to use.

    profile
        Dict, or pillar key pointing to a dict, containing AWS region/key/keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cloudfront.get_distributions_by_comment 'Comment=foobar'
        salt myminion boto_cloudfront.get_distributions_by_comment 'Comment=foobar:Plus a real comment'

def get_distributions_by_comment(Comment, region=None, key=None, keyid=None, profile=None):
    '''
    Find and return any CloudFront distributions which happen to have a Comment sub-field
    either exactly matching the given Comment, or beginning with it AND with the remainder
    separated by a colon.

    Comment
        The string to be matched when searching for the given Distribution.  Note that this
        will be matched against both the exact value of the Comment sub-field, AND as a
        colon-separated initial value for the same Comment sub-field.  E.g. given a passed
        `Comment` value of `foobar`, this would match a distribution with EITHER a
        Comment sub-field of exactly `foobar`, OR a Comment sub-field beginning with
        `foobar:`.  The intention here is to permit using the Comment field for storing
        actual comments, in addition to overloading it to store Salt's `Name` attribute.

    region
        Region to connect to.

    key
        Secret key to use.

    keyid
        Access key to use.

    profile
        Dict, or pillar key pointing to a dict, containing AWS region/key/keyid.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_cloudfront.get_distributions_by_comment 'Comment=foobar'
        salt myminion boto_cloudfront.get_distributions_by_comment 'Comment=foobar:Plus a real comment'

    '''
    log.debug('Dereferincing CloudFront distribution(s) by Comment `%s`.', Comment)
    ret = list_distributions(region=region, key=key, keyid=keyid, profile=profile)
    if ret is None:
        return ret
    items = []
    for item in ret:
        comment = item.get('Comment')
        # Comment field is never None, so it can only match if both exist...
        if comment == Comment or comment.startswith('{0}:'.format(Comment)):
            items += [item]
    return items