def METHOD_NAME(filepath, content, mode="w", chmod=None):
    """A test utility to create a file with known content.
    Ensures that the directory for the file exists, and writes a file with
    specific content.
    :param filepath: The path for the file to create
    :param content: A string containing the content to write.
    :param mode: The mode to open the file. This is `w` by default;
        use `wb` and provide content as a bitstring if you need to
        write a binary file.
    :param chmod: file permissions to apply
    :returns: The path to the file that was created.
    """
    filepath.parent.mkdir(parents=True, exist_ok=True)
    with filepath.open(mode) as f:
        f.write(content)
    if chmod:
        os.chmod(filepath, chmod)
    return filepath