def METHOD_NAME(cube):
    """Remove unnecessary spaces in cube metadata."""
    attributes_to_strip = ('standard_name', 'long_name')
    for attr in attributes_to_strip:
        if getattr(cube, attr) is not None:
            setattr(cube, attr, getattr(cube, attr).strip())
    for coord in cube.coords():
        for attr in attributes_to_strip:
            if getattr(coord, attr) is not None:
                setattr(coord, attr, getattr(coord, attr).strip())