def METHOD_NAME(name):
    """
    Escapes any character of `name` that may not be used in graphite metric
    names.
    """
    if name is None:
        return name
    name = name.replace('\x00', '')  # some devices have crazy responses!
    name = ''.join([c if c in LEGAL_METRIC_CHARACTERS else "_" for c in name])
    return name