def get_url_prefix(build):
    """Generate a Ensembl REST API URL prefix for the given build."""
    if build.lower() in ('grch37', 'hg19'):
        return 'http://grch37.rest.ensembl.org/'
    elif build.lower() in ('grch38', 'hg38'):
        return 'http://rest.ensembl.org/'
    else:
        raise ValueError(
            "Invalid build '{}'. Valid builds are: GRCh37 and GRCh38.".
            format(build))
