code: def safe_format_sh(s, **kwargs):
    
  
    to_replace = set(kwargs.keys()) & set(FORMAT_RE.findall(s))
  
    for item in to_replace:
      s = s.replace("{{" + item + "}}", kwargs[item])
  
    return s
docs: :type s str