def METHOD_NAME(val):
    """Helper method to try to convert value to gemmi.SpaceGroup"""
    # GH#18: Type-checking for supported input types
    if isinstance(val, gemmi.SpaceGroup) or (val is None):
        return val
    elif isinstance(val, (str, int)):
        return gemmi.SpaceGroup(val)
    else:
        raise ValueError(f"Cannot construct gemmi.SpaceGroup from value: {val}")