def standardize_sex(series):
mapper = {<EOL>"<STR_LIT:M>": "<STR_LIT:M>",<EOL>"<STR_LIT>": "<STR_LIT:M>",<EOL>"<STR_LIT>": "<STR_LIT:M>",<EOL>"<STR_LIT:F>": "<STR_LIT:F>",<EOL>"<STR_LIT>": "<STR_LIT:F>",<EOL>"<STR_LIT>": "<STR_LIT:F>",<EOL>}<EOL>if series.str.islower().any():<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return series.apply(lambda x: mapper[x])<EOL><DEDENT>
Return a series where common representations of 'male'/'female' are standardized.

    Things like ['M', 'MALE', 'M', 'BOY', ...] are converted to `M`.
    Representations of female are treated similarly.