import re


def sanitize_file_format(file_format):
    """
    Returns a uniform file format string.

    Parameters
    ----------
    file_format: str
        Extension of the file.

    Returns
    -------
    file_format: str
        The sanitized file format.
    """

    if re.match(r"^\.?[a-zA-Z\d]+$", file_format) is None:
        raise NameError(
            "read_structure_step: the file format %s could not be validated"
            % file_format
        )

    file_format = file_format.lower()

    if file_format.startswith(".") is False:
        file_format = "." + file_format

    return file_format