from typing import AnyStr


def write_file(filepath: str, content: AnyStr, *args, **kwargs) -> AnyStr:
    """Writes to a file and returns the content

    Parameters
    ----------
    filepath : str
        The path to the file to write to
    content: AnyStr
        The content to write to the file

    Returns
    -------
    AnyStr
        The thing that was written to the file
    """
    with open(filepath, "w" if content is str else "wb", *args, **kwargs) as f:
        f.write(content)
        return content