Converts a floating point value into a percentage value.
    
    Number of decimal places set by the `decimal_places` kwarg. Default is one.
    
    By default the number is multiplied by 100. You can prevent it from doing
    that by setting the `multiply` keyword argument to False.
    
    If the submitted value isn't a string, returns the `failure_string` keyword
    argument.

def percentage(value, decimal_places=1, multiply=True, failure_string='N/A'):
    """
    Converts a floating point value into a percentage value.
    
    Number of decimal places set by the `decimal_places` kwarg. Default is one.
    
    By default the number is multiplied by 100. You can prevent it from doing
    that by setting the `multiply` keyword argument to False.
    
    If the submitted value isn't a string, returns the `failure_string` keyword
    argument.
    """
    try:
        value = float(value)
    except ValueError:
        return failure_string
    if multiply:
        value = value * 100
    return _saferound(value, decimal_places) + '%'