def METHOD_NAME(seq_str, format):
    if len(seq_str) == 0:
        raise InvalidFileError("The file's 'ORIGIN' field is empty")
    if format == "gb":
        return NucleotideSequence(seq_str.replace("U","T").replace("X","N"))
    elif format == "gp":
        if "U" in seq_str:
            warnings.warn(
                "ProteinSequence objects do not support selenocysteine (U), "
                "occurrences were substituted by cysteine (C)"
            )
            seq_str = seq_str.replace("U", "C")
        return ProteinSequence(seq_str)
    else:
        raise ValueError(f"Unknown format '{format}'")