def formatValueIfNotEmpty(template, value):
    """Formats value if template is given, if not, the just convert it into string. Returns empty string if value is None.

    :param str template: string formating template
    :param str value: value to be formated
    :return: formatted value
    :rtype: str

    >>> formatValueIfNotEmpty("%3.1f", 8.54684)
    '8.5'

    >>> formatValueIfNotEmpty("%f3.1", None)
    ''

    """
    if value:
        if template.find('%') >= 0:
            return template % value
        else:
            return template
    else:
        return ""