def _create_depend_tag(dep_type,
                       name,
                       version_eq=None,
                       version_lt=None,
                       version_lte=None,
                       version_gt=None,
                       version_gte=None):

    version_string = []
    for key, var in {'version_eq': version_eq,
                     'version_lt': version_lt,
                     'version_lte': version_lte,
                     'version_gt': version_gt,
                     'version_gte': version_gte}.items():
        if var is not None:
            version_string.append(' %s="%s"' % (key, var))
    result = '  <%s%s>%s</%s>\n' % (dep_type,
                                    ''.join(version_string),
                                    name,
                                    dep_type)
    return result
Helper to create xml snippet for package.xml
dataset/ETHPy150Open ros-infrastructure/catkin_pkg/src/catkin_pkg/package_templates.py/_create_depend_tag