def METHOD_NAME(fp, content, mode="w", encoding=None):
    """Write content to fp, whether fp is a string, a pathlib Path or a
    file-like object"""
    if isinstance(fp, str) or isinstance(fp, pathlib.PurePath):
        with open(file=fp, mode=mode, encoding=encoding) as f:
            f.write(content)
    else:
        fp.write(content)